MCPcopy Create free account
hub / github.com/blobcache/blobcache / readAddrPort

Function readAddrPort

src/blobcache/fq.go:135–149  ·  view source on GitHub ↗
(x []byte)

Source from the content-addressed store, hash-verified

133}
134
135func readAddrPort(x []byte) (*netip.AddrPort, []byte, error) {
136 var pos int
137 for {
138 i := slices.Index(x[pos+1:], ':')
139 if i == -1 {
140 return nil, x, fmt.Errorf("could not parse address port")
141 } else {
142 pos = i + pos + 1
143 }
144 ap, err := netip.ParseAddrPort(string(x[:pos]))
145 if err == nil {
146 return &ap, x[pos+1:], nil
147 }
148 }
149}
150
151// readOID reads an OID from a URL
152// If no OID can be parsed, then the rest is returned.

Callers 1

UnmarshalTextMethod · 0.85

Calls 1

IndexMethod · 0.45

Tested by

no test coverage detected