Bug Fixes

- It was not possible to use IPv6 addresses
- Some times, Ocean chose the address fe80::1
This commit is contained in:
Thorsten Sommer 2015-03-09 15:32:48 +01:00
parent 5def8d0785
commit 093a3988c0
2 changed files with 10 additions and 2 deletions

View File

@ -27,7 +27,7 @@ func initIPAddresses4ThisHost() {
}
ip := net.ParseIP(addressText)
if !ip.IsLoopback() && !ip.IsUnspecified() {
if !ip.IsLoopback() && !ip.IsUnspecified() && strings.ToLower(ip.String()) != `fe80::1` {
ipAddresses[counter] = ip.String()
counter++
}

View File

@ -1,11 +1,13 @@
package Tools
import (
"fmt"
"github.com/SommerEngineering/Ocean/ConfigurationDB"
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
"math/rand"
"os"
"strings"
"time"
)
@ -30,7 +32,13 @@ func init() {
// Build the local IP address and port:
allHostsIPAddresses := ReadAllIPAddresses4ThisHost()
port := ConfigurationDB.Read(`PublicWebServerPort`)
localIPAddressAndPort = allHostsIPAddresses[0] + `:` + port
if strings.Contains(allHostsIPAddresses[0], `:`) {
// Case: IPv6
localIPAddressAndPort = fmt.Sprintf("[%s]:%s", allHostsIPAddresses[0], port)
} else {
// Case: IPv4
localIPAddressAndPort = fmt.Sprintf("%s:%s", allHostsIPAddresses[0], port)
}
// Read the default language:
defaultLanguage = ConfigurationDB.Read(`DefaultLanguageCode`)