remove the -D proxy option
It doesn't do anything useful since the weave script needs to be able to talk to docker on the standard unix socket. Fixes #972.
This commit is contained in:
1 parent
0c87dcd656
commit
b483be8c4b
4 files changed
+11
-34
No files matched your search
@@ -12,7 +12,6 @@ import (
|
||||
|
||||
var (
|
||||
version = "(unreleased version)"
|
||||
defaultDockerAddr = "unix:///var/run/docker.sock"
|
||||
defaultListenAddr = "tcp://0.0.0.0:12375"
|
||||
)
|
||||
|
||||
@@ -20,17 +19,13 @@ func main() {
|
||||
var (
|
||||
debug bool
|
||||
justVersion bool
|
||||
c = proxy.Config{
|
||||
DockerAddr: defaultDockerAddr,
|
||||
ListenAddr: defaultListenAddr,
|
||||
}
|
||||
c = proxy.Config{ListenAddr: defaultListenAddr}
|
||||
)
|
||||
|
||||
c.Version = version
|
||||
getopt.BoolVarLong(&debug, "debug", 'd', "log debugging information")
|
||||
getopt.BoolVarLong(&justVersion, "version", 0, "print version and exit")
|
||||
getopt.StringVar(&c.ListenAddr, 'H', fmt.Sprintf("address on which to listen (default %s)", defaultListenAddr))
|
||||
getopt.StringVar(&c.DockerAddr, 'D', fmt.Sprintf("docker daemon URL to proxy (default %s)", defaultDockerAddr))
|
||||
getopt.BoolVarLong(&c.NoDefaultIPAM, "no-default-ipam", 0, "do not automatically allocate addresses for containers without a WEAVE_CIDR")
|
||||
getopt.StringVarLong(&c.TLSConfig.CACert, "tlscacert", 0, "Trust certs signed only by this CA")
|
||||
getopt.StringVarLong(&c.TLSConfig.Cert, "tlscert", 0, "Path to TLS certificate file")
|
||||
|
||||
+7
-25
@@ -4,7 +4,6 @@ import (
|
||||
"crypto/tls"
|
||||
"net"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
@@ -25,7 +24,6 @@ var (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
DockerAddr string
|
||||
ListenAddr string
|
||||
NoDefaultIPAM bool
|
||||
TLSConfig TLSConfig
|
||||
@@ -36,32 +34,12 @@ type Config struct {
|
||||
|
||||
type Proxy struct {
|
||||
Config
|
||||
|
||||
dial func() (net.Conn, error)
|
||||
client *docker.Client
|
||||
dockerBridgeIP string
|
||||
}
|
||||
|
||||
func NewProxy(c Config) (*Proxy, error) {
|
||||
u, err := url.Parse(c.DockerAddr)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
targetAddr := ""
|
||||
switch u.Scheme {
|
||||
case "tcp":
|
||||
targetAddr = u.Host
|
||||
case "unix":
|
||||
targetAddr = u.Path
|
||||
}
|
||||
|
||||
p := &Proxy{
|
||||
Config: c,
|
||||
dial: func() (net.Conn, error) {
|
||||
return net.Dial(u.Scheme, targetAddr)
|
||||
},
|
||||
}
|
||||
p := &Proxy{Config: c}
|
||||
|
||||
if !p.WithoutDNS {
|
||||
dockerBridgeIP, err := callWeave("docker-bridge-ip")
|
||||
@@ -75,14 +53,18 @@ func NewProxy(c Config) (*Proxy, error) {
|
||||
Error.Fatalf("Could not configure tls for proxy: %s", err)
|
||||
}
|
||||
|
||||
p.client, err = docker.NewClient(p.DockerAddr)
|
||||
client, err := docker.NewClient("unix:///var/run/docker.sock")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
p.client = client
|
||||
return p, nil
|
||||
}
|
||||
|
||||
func (proxy *Proxy) Dial() (net.Conn, error) {
|
||||
return net.Dial("unix", "/var/run/docker.sock")
|
||||
}
|
||||
|
||||
func (proxy *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
Info.Printf("%s %s", r.Method, r.URL)
|
||||
path := r.URL.Path
|
||||
|
||||
@@ -28,7 +28,7 @@ func (proxy *Proxy) Intercept(i interceptor, w http.ResponseWriter, r *http.Requ
|
||||
return
|
||||
}
|
||||
|
||||
conn, err := proxy.dial()
|
||||
conn, err := proxy.Dial()
|
||||
if err != nil {
|
||||
http.Error(w, "Could not connect to target", http.StatusInternalServerError)
|
||||
Warning.Print(err)
|
||||
|
||||
@@ -29,8 +29,8 @@ usage() {
|
||||
echo "weave launch [-password <password>] [-nickname <nickname>] [-nodiscovery]"
|
||||
echo " [-iprange <cidr> [-ipsubnet <cidr>]] <peer> ..."
|
||||
echo "weave launch-dns [<addr>]"
|
||||
echo "weave launch-proxy [-D <endpoint>] [-H <endpoint>]"
|
||||
echo " [--with-dns | --without-dns] [--no-default-ipam]"
|
||||
echo "weave launch-proxy [-H <endpoint>] [--with-dns | --without-dns]"
|
||||
echo " [--no-default-ipam]"
|
||||
echo "weave connect [--replace] [<peer> ...]"
|
||||
echo "weave forget <peer> ..."
|
||||
echo "weave run [--with-dns | --without-dns] [<addr> ...] <docker run args> ..."
|
||||
|
||||
Reference in new issue
Block a user