(section *ini.Section, keyName string)
| 100 | } |
| 101 | |
| 102 | func 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 | |
| 120 | func parseTCPAddr(section *ini.Section, keyName string) (*net.TCPAddr, error) { |
| 121 | addrStr, err := parseString(section, keyName) |
no outgoing calls
no test coverage detected