WIP: stun proxy

This commit is contained in:
Simon Ding
2025-05-07 18:16:10 +08:00
parent 5375f66018
commit 9719c6a7c9
10 changed files with 557 additions and 57 deletions

31
pkg/nat/cmd/main.go Normal file
View File

@@ -0,0 +1,31 @@
package main
import (
"net"
"polaris/log"
"polaris/pkg/nat"
)
func main() {
// This is a placeholder for the main function.
// The actual implementation will depend on the specific requirements of the application.
src, err := net.Listen("tcp", ":8080")
if err != nil {
panic(err)
}
for {
conn, err := src.Accept()
if err != nil {
panic(err)
}
log.Infof("new connection: %+v", conn)
dest, err := net.Dial("tcp", "10.0.0.8:8080")
if err != nil {
panic(err)
}
go nat.ReverseProxy(conn, dest)
}
select {}
}