mirror of https://github.com/ehang-io/nps
fix: fix localhost proxy
parent
c9a4d8285b
commit
9353b8afa8
|
@ -24,9 +24,9 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
type Client struct {
|
||||||
tunnel *nps_mux.Mux
|
tunnel *nps_mux.Mux // WORK_CHAN connection
|
||||||
signal *conn.Conn
|
signal *conn.Conn // WORK_MAIN connection
|
||||||
file *nps_mux.Mux
|
file *nps_mux.Mux // WORK_FILE connection
|
||||||
Version string
|
Version string
|
||||||
retryTime int // it will be add 1 when ping not ok until to 3 will close the client
|
retryTime int // it will be add 1 when ping not ok until to 3 will close the client
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@ func (s *Flow) Add(in, out int64) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
U string
|
U string // username
|
||||||
P string
|
P string // password
|
||||||
Compress bool
|
Compress bool
|
||||||
Crypt bool
|
Crypt bool
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,9 @@ func (s *Sock5ModeServer) sendReply(c net.Conn, rep uint8) {
|
||||||
localAddr := c.LocalAddr().String()
|
localAddr := c.LocalAddr().String()
|
||||||
localHost, localPort, _ := net.SplitHostPort(localAddr)
|
localHost, localPort, _ := net.SplitHostPort(localAddr)
|
||||||
ipBytes := net.ParseIP(localHost).To4()
|
ipBytes := net.ParseIP(localHost).To4()
|
||||||
|
if ipBytes == nil {
|
||||||
|
ipBytes = net.ParseIP("127.0.0.1").To4()
|
||||||
|
}
|
||||||
nPort, _ := strconv.Atoi(localPort)
|
nPort, _ := strconv.Atoi(localPort)
|
||||||
reply = append(reply, ipBytes...)
|
reply = append(reply, ipBytes...)
|
||||||
portBytes := make([]byte, 2)
|
portBytes := make([]byte, 2)
|
||||||
|
|
Loading…
Reference in New Issue