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