relay packets to target host
This commit is contained in:
parent
93b372c945
commit
e99e804013
12
knockr.go
12
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)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user