(in string)
| 336 | } |
| 337 | |
| 338 | func parsePort(in string) (uint16, error) { |
| 339 | port, err := strconv.ParseUint(strings.TrimSpace(in), 10, 16) |
| 340 | if err != nil { |
| 341 | return 0, xerrors.Errorf("parse port %q: %w", in, err) |
| 342 | } |
| 343 | if port == 0 { |
| 344 | return 0, xerrors.New("port cannot be 0") |
| 345 | } |
| 346 | |
| 347 | return uint16(port), nil |
| 348 | } |
| 349 | |
| 350 | // specRegexp matches port specs. It handles all the following formats: |
| 351 | // |
no test coverage detected