mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
WIP: stun proxy
This commit is contained in:
31
pkg/nat/cmd/main.go
Normal file
31
pkg/nat/cmd/main.go
Normal 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 {}
|
||||
}
|
||||
Reference in New Issue
Block a user