(x []byte)
| 133 | } |
| 134 | |
| 135 | func 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. |