convertIntToUint16 converts the given int to a uint16.
(port int)
| 418 | |
| 419 | // convertIntToUint16 converts the given int to a uint16. |
| 420 | func convertIntToUint16(port int) (uint16, error) { |
| 421 | var updatedPort uint16 |
| 422 | if port >= 0 && port <= 65535 { |
| 423 | updatedPort = uint16(port) |
| 424 | } else { |
| 425 | return 0, fmt.Errorf("invalid port number: %d", port) |
| 426 | } |
| 427 | |
| 428 | return updatedPort, nil |
| 429 | } |
| 430 | |
| 431 | // trafficMonitor implements io.Reader. It keeps the session alive by notifying |
| 432 | // it of the traffic type during Read operations. |
no test coverage detected