mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-07-02 16:10:49 +02:00
Support unix domain sockets.
This commit is contained in:
@ -12,6 +12,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"bitbucket.org/s_l_teichmann/mtsatellite/common"
|
||||
@ -117,7 +118,14 @@ func main() {
|
||||
|
||||
var listener net.Listener
|
||||
|
||||
listener, err = net.Listen("tcp", fmt.Sprintf("%s:%d", host, port))
|
||||
var proto, address string
|
||||
if strings.ContainsRune(host, '/') {
|
||||
proto, address = "unix", host
|
||||
} else {
|
||||
proto, address = "tcp", fmt.Sprintf("%s:%d", host, port)
|
||||
}
|
||||
|
||||
listener, err = net.Listen(proto, address)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user