Compare commits

..

No commits in common. "master" and "master" have entirely different histories.

2 changed files with 9 additions and 14 deletions

View File

@ -10,19 +10,14 @@ via the `--config` argument.
Address to listen for connections on in the format of `interface:port`.
### Listen on all addresses (IPv4 and IPv6)
`:1965`
### Listen on a specific address (IPv4 or IPv6)
`192.0.2.1:1965` or `"[2001:db8::1]:1965"` (please note the quotes and brackets
for IPv6 addresses).
### Listen on localhost (IPv4 only)
### Listen on localhost
`localhost:1965`
### Listen on all interfaces
`:1965`
## Types
Content types may be defined by file extension. When a type is not defined for

View File

@ -127,13 +127,13 @@ func readconfig(configPath string) error {
newLine = "\r\n"
}
listenRe := regexp.MustCompile("(.*):([0-9]+)$")
if !listenRe.MatchString(config.Listen) {
split := strings.Split(config.Listen, ":")
if len(split) != 2 {
config.hostname = config.Listen
config.Listen += ":1965"
} else {
config.hostname = listenRe.ReplaceAllString(config.Listen, "$1")
config.port, err = strconv.Atoi(listenRe.ReplaceAllString(config.Listen, "$2"))
config.hostname = split[0]
config.port, err = strconv.Atoi(split[1])
if err != nil {
log.Fatalf("invalid port specified: %s", err)
}