doo-proxy is a simple http/https proxy implement by golang
go get github.com/PualrDwade/doo-proxy
go install github.com/PualrDwade/doo-proxy
./doo-proxy -credential "aksldjhlkasdj" (your credential)
all thing to understand is a code snippet bellow:
func (proxy *dooProxy) tunnel(clientConn net.Conn, remoteConn net.Conn) {
group := &sync.WaitGroup{}
group.Add(2)
go func() {
defer group.Done()
_, err := io.Copy(remoteConn, clientConn)
if err != nil {
log.Error(err.Error())
}
}()
go func() {
defer group.Done()
_, err := io.Copy(clientConn, remoteConn)
if err != nil {
log.Error(err.Error())
}
}()
group.Wait()
}