proxy: update the 9P protocol

We now tell the 9P server

 proto1:ip1:port1:<address for forwarding>

which means please listen on proto1:ip1:port1, then connect to the port
proxy in Moby and tell it the connection is for <address for forwarding>.

Note this requires a corresponding change in hostnet/vpnkit.

Signed-off-by: David Scott <dave.scott@docker.com>
This commit is contained in:
David Scott 2016-05-18 21:37:17 +01:00
parent 980588b68f
commit d46052773d

View File

@ -23,7 +23,7 @@ func onePort() {
sendError(err)
}
ctl, err := exposePort(host, port)
ctl, err := exposePort(host, container)
if err != nil {
sendError(err)
}
@ -37,8 +37,8 @@ func onePort() {
os.Exit(0)
}
func exposePort(host net.Addr, port int) (*os.File, error) {
name := host.Network() + ":" + host.String()
func exposePort(host net.Addr, container net.Addr) (*os.File, error) {
name := host.Network() + ":" + host.String() + ":" + container.Network() + ":" + container.String()
log.Printf("exposePort %s\n", name)
err := os.Mkdir("/port/"+name, 0)
if err != nil {
@ -50,7 +50,7 @@ func exposePort(host net.Addr, port int) (*os.File, error) {
log.Printf("Failed to open /port/%s/ctl: %#v\n", name, err)
return nil, err
}
_, err = ctl.WriteString(fmt.Sprintf("%s:%08x", name, port))
_, err = ctl.WriteString(fmt.Sprintf("%s", name))
if err != nil {
log.Printf("Failed to open /port/%s/ctl: %#v\n", name, err)
return nil, err