[proxy] Add support for tcp:// prefix on listen addresses
This commit is contained in:
1 parent
0da9669e5c
commit
447a00ba7e
2 files changed
+12
-2
No files matched your search
+11
-1
@@ -13,7 +13,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
version = "(unreleased version)"
|
version = "(unreleased version)"
|
||||||
defaultDockerAddr = "unix:///var/run/docker.sock"
|
defaultDockerAddr = "unix:///var/run/docker.sock"
|
||||||
defaultListenAddr = ":12375"
|
defaultListenAddr = "tcp://0.0.0.0:12375"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -52,6 +52,16 @@ func main() {
|
|||||||
Info.Println("weave proxy", version)
|
Info.Println("weave proxy", version)
|
||||||
Info.Println("Command line arguments:", strings.Join(os.Args[1:], " "))
|
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)
|
p, err := proxy.NewProxy(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
Error.Fatalf("Could not start proxy: %s", err)
|
Error.Fatalf("Could not start proxy: %s", err)
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ usage() {
|
|||||||
echo "where <peer> = <ip_address_or_fqdn>[:<port>]"
|
echo "where <peer> = <ip_address_or_fqdn>[:<port>]"
|
||||||
echo " <cidr> = <ip_address>/<routing_prefix_length>"
|
echo " <cidr> = <ip_address>/<routing_prefix_length>"
|
||||||
echo " <peer_id> = <nickname> or weave internal peer ID"
|
echo " <peer_id> = <nickname> or weave internal peer ID"
|
||||||
echo " <address> = [<ip_address>]:<port>"
|
echo " <address> = [tcp://][<ip_address>]:<port>"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user