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

Function ParseEndpoint

src/blobcache/volume.go:220–240  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

218}
219
220func ParseEndpoint(s string) (Endpoint, error) {
221 parts := strings.SplitN(s, ":", 2)
222 if len(parts) == 0 {
223 return Endpoint{}, fmt.Errorf("invalid endpoint: %s", s)
224 }
225 peer, err := inet256.ParseAddrBase64([]byte(parts[0]))
226 if err != nil {
227 return Endpoint{}, err
228 }
229 var ap netip.AddrPort
230 if len(parts) >= 2 {
231 ap, err = netip.ParseAddrPort(parts[1])
232 if err != nil {
233 return Endpoint{}, err
234 }
235 }
236 return Endpoint{
237 Node: peer,
238 IPPort: ap,
239 }, nil
240}
241
242// VolumeSpec is a specification for a volume.
243type VolumeSpec = VolumeBackend[Handle]

Callers 3

EndpointMethod · 0.92
volume.goFile · 0.92
buildRemoteSpecMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected