Beispiel #1
0
func RunRemote(tunnel proxy.Proxy, signal Signal) error {
	ln, err := net2.RetryListen("tcp", tunnel.Addr(), 5, 1000)
	if err != nil {
		return err
	}

	r := &Remote{
		tunnel:   tunnel,
		signal:   signal,
		listener: ln,
		log:      log.Derive("Remote", tunnel.Addr()),
	}
	go r.serve()
	return nil
}
Beispiel #2
0
func RunLocal(sock proxy.Proxy, tunnels []proxy.Proxy, signal Signal, directList, tunnelList, suffixList *SiteList) error {
	ln, err := net2.RetryListen("tcp", sock.Addr(), 5, 1000)
	if err != nil {
		return err
	}

	local := &Local{
		directList: directList,
		tunnelList: tunnelList,
		suffixList: suffixList,

		sock:     sock,
		tunnels:  tunnels,
		listener: ln,
		signal:   signal,
		log:      log.Derive("Local", sock.Addr()),
	}

	go local.serve()
	return nil
}