MCPcopy Index your code
hub / github.com/windtf/wireproxy / parsePort

Function parsePort

config.go:102–118  ·  view source on GitHub ↗
(section *ini.Section, keyName string)

Source from the content-addressed store, hash-verified

100}
101
102func parsePort(section *ini.Section, keyName string) (int, error) {
103 key := section.Key(keyName)
104 if key == nil {
105 return 0, errors.New(keyName + " should not be empty")
106 }
107
108 port, err := key.Int()
109 if err != nil {
110 return 0, err
111 }
112
113 if port < 0 || port >= 65536 {
114 return 0, errors.New("port should be >= 0 and < 65536")
115 }
116
117 return port, nil
118}
119
120func parseTCPAddr(section *ini.Section, keyName string) (*net.TCPAddr, error) {
121 addrStr, err := parseString(section, keyName)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected