relay packets to target host

This commit is contained in:
maride 2017-09-27 16:40:29 +02:00
parent 93b372c945
commit e99e804013

View File

@ -48,7 +48,7 @@ func gateway_handler(c net.Conn) {
if is_whitelisted(host) {
fmt.Println("OK: ", host)
io.WriteString(c, "Hola o/")
proxy(c)
} else {
fmt.Println("BLOCK: ", host)
}
@ -70,3 +70,13 @@ func is_whitelisted(addr string) bool {
return false
}
func proxy(c net.Conn) {
ln, err := net.Dial("tcp", "ip.darknebu.la:443")
if err != nil {
fmt.Println("ERR proxy")
} else {
go io.Copy(c, ln)
io.Copy(ln, c)
}
}