func localToRemote(localConn, remoteConn net.Conn) chan bool {
	exit := make(chan bool, 2)
	go func(quit chan bool) {
		io.Copy(remoteConn, localConn)
		remoteConn.SetDeadline(time.Now())
		localConn.SetDeadline(time.Now())
		quit <- true
	}(exit)
	return exit
}
Relay data from local to remote
On error stop both connection
package magic
import (
	"encoding/binary"
	"io"
	"net"
	"time"
)