diff --git a/cmd/mtwebmapper/main.go b/cmd/mtwebmapper/main.go index 22f14c6..364f908 100644 --- a/cmd/mtwebmapper/main.go +++ b/cmd/mtwebmapper/main.go @@ -10,32 +10,12 @@ import ( "log" "net" "net/http" - "strings" "bitbucket.org/s_l_teichmann/mtsatellite/common" "github.com/gorilla/mux" ) -func ipsFromHosts(hosts string) ([]net.IP, error) { - - ips := []net.IP{} - - if len(hosts) == 0 { // Empty list: allow all hosts. - return ips, nil - } - - for _, host := range strings.Split(hosts, ";") { - if hips, err := net.LookupIP(host); err != nil { - return nil, err - } else { - ips = append(ips, hips...) - } - } - - return ips, nil -} - func main() { var ( webPort int diff --git a/cmd/mtwebmapper/misc.go b/cmd/mtwebmapper/misc.go new file mode 100644 index 0000000..85327b3 --- /dev/null +++ b/cmd/mtwebmapper/misc.go @@ -0,0 +1,36 @@ +// Copyright 2014 by Sascha L. Teichmann +// Use of this source code is governed by the MIT license +// that can be found in the LICENSE file. + +package main + +import ( + "net" + "strings" +) + +func ipsFromHosts(hosts string) ([]net.IP, error) { + + ips := []net.IP{} + + if len(hosts) == 0 { // Empty list: allow all hosts. + return ips, nil + } + + for _, host := range strings.Split(hosts, ";") { + if hips, err := net.LookupIP(host); err != nil { + return nil, err + } else { + ips = append(ips, hips...) + } + } + + return ips, nil +} + +func min(a, b int) int { + if a < b { + return a + } + return b +} diff --git a/cmd/mtwebmapper/tilesupdater.go b/cmd/mtwebmapper/tilesupdater.go index 6277d52..cadd3ff 100644 --- a/cmd/mtwebmapper/tilesupdater.go +++ b/cmd/mtwebmapper/tilesupdater.go @@ -205,13 +205,6 @@ func (tu *tileUpdater) doUpdates() { } } -func min(a, b int) int { - if a < b { - return a - } - return b -} - func updatePyramidTiles(level int, baseDir string, jobs chan xzm, done *sync.WaitGroup) { defer done.Done() scratch := image.NewRGBA(image.Rect(0, 0, 256, 256))