You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
435 B
Go
27 lines
435 B
Go
9 years ago
|
package main
|
||
|
|
||
|
import (
|
||
8 years ago
|
socks "github.com/fangdingjun/socks-go"
|
||
9 years ago
|
"log"
|
||
|
"net"
|
||
8 years ago
|
"time"
|
||
9 years ago
|
)
|
||
|
|
||
|
func main() {
|
||
|
conn, err := net.Listen("tcp", ":1080")
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
for {
|
||
|
c, err := conn.Accept()
|
||
|
if err != nil {
|
||
|
log.Println(err)
|
||
|
continue
|
||
|
}
|
||
|
log.Printf("connected from %s", c.RemoteAddr())
|
||
8 years ago
|
d := net.Dialer{Timeout: 10 * time.Second}
|
||
|
s := socks.SocksConn{ClientConn: c, Dial: d.Dial}
|
||
9 years ago
|
go s.Serve()
|
||
|
}
|
||
|
}
|