(s string)
| 218 | } |
| 219 | |
| 220 | func 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. |
| 243 | type VolumeSpec = VolumeBackend[Handle] |
no outgoing calls
no test coverage detected