MCPcopy Create free account
hub / github.com/cli/cli / convertIntToUint16

Function convertIntToUint16

internal/codespaces/portforwarder/port_forwarder.go:420–429  ·  view source on GitHub ↗

convertIntToUint16 converts the given int to a uint16.

(port int)

Source from the content-addressed store, hash-verified

418
419// convertIntToUint16 converts the given int to a uint16.
420func 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.

Callers 4

ForwardPortToListenerMethod · 0.85
ForwardPortMethod · 0.85
UpdatePortVisibilityMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected