From e99e80401364ddd6bdf02dbf2d5d461811ace52b Mon Sep 17 00:00:00 2001 From: maride Date: Wed, 27 Sep 2017 16:40:29 +0200 Subject: [PATCH] relay packets to target host --- knockr.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/knockr.go b/knockr.go index 6dc1ad1..3c2c369 100644 --- a/knockr.go +++ b/knockr.go @@ -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) + } +}