[proxy] Add support for tcp:// prefix on listen addresses

This commit is contained in:
Paul Bellamy committed 2015-06-10 12:13:52 +01:00
1 parent 0da9669e5c
commit 447a00ba7e
2 files changed
+12 -2

No files matched your search

+11 -1
View File
@@ -13,7 +13,7 @@ import (
var (
version = "(unreleased version)"
defaultDockerAddr = "unix:///var/run/docker.sock"
defaultListenAddr = ":12375"
defaultListenAddr = "tcp://0.0.0.0:12375"
)
func main() {
@@ -52,6 +52,16 @@ func main() {
Info.Println("weave proxy", version)
Info.Println("Command line arguments:", strings.Join(os.Args[1:], " "))
protoAddrParts := strings.SplitN(c.ListenAddr, "://", 2)
if len(protoAddrParts) == 2 {
if protoAddrParts[0] != "tcp" {
Error.Fatalf("Invalid protocol format: %q", protoAddrParts[0])
}
c.ListenAddr = protoAddrParts[1]
} else {
c.ListenAddr = protoAddrParts[0]
}
p, err := proxy.NewProxy(c)
if err != nil {
Error.Fatalf("Could not start proxy: %s", err)
+1 -1
View File
@@ -51,7 +51,7 @@ usage() {
echo "where <peer> = <ip_address_or_fqdn>[:<port>]"
echo " <cidr> = <ip_address>/<routing_prefix_length>"
echo " <peer_id> = <nickname> or weave internal peer ID"
echo " <address> = [<ip_address>]:<port>"
echo " <address> = [tcp://][<ip_address>]:<port>"
exit 1
}