mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-12-04 01:17:45 +00:00
This patch removes `proxyForever` and adds `sendError` and `sendOK` for signalling to the parent process. The main function now sequences these functions and calls stub functions `exposePort` and `unexposePort` which will be hooked up in a later patch. Signed-off-by: David Scott <dave.scott@docker.com>
37 lines
531 B
Go
37 lines
531 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
"net"
|
|
"os"
|
|
"pkg/proxy"
|
|
)
|
|
|
|
func main() {
|
|
host, container := parseHostContainerAddrs()
|
|
|
|
err := exposePort(host)
|
|
if err != nil {
|
|
sendError(err)
|
|
}
|
|
p, err := proxy.NewProxy(host, container)
|
|
if err != nil {
|
|
unexposePort(host)
|
|
sendError(err)
|
|
}
|
|
go handleStopSignals(p)
|
|
sendOK()
|
|
p.Run()
|
|
unexposePort(host)
|
|
os.Exit(0)
|
|
}
|
|
|
|
func exposePort(host net.Addr) error {
|
|
log.Printf("exposePort %#v\n", host)
|
|
return nil
|
|
}
|
|
|
|
func unexposePort(host net.Addr) {
|
|
log.Printf("unexposePort %#v\n", host)
|
|
}
|