Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix localhost proxy #830

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bridge/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
)

type Client struct {
tunnel *nps_mux.Mux
signal *conn.Conn
file *nps_mux.Mux
tunnel *nps_mux.Mux // WORK_CHAN connection
signal *conn.Conn // WORK_MAIN connection
file *nps_mux.Mux // WORK_FILE connection
Version string
retryTime int // it will be add 1 when ping not ok until to 3 will close the client
}
Expand Down
4 changes: 2 additions & 2 deletions lib/file/obj.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ func (s *Flow) Add(in, out int64) {
}

type Config struct {
U string
P string
U string // username
P string // password
Compress bool
Crypt bool
}
Expand Down
3 changes: 3 additions & 0 deletions server/proxy/socks5.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ func (s *Sock5ModeServer) sendReply(c net.Conn, rep uint8) {
localAddr := c.LocalAddr().String()
localHost, localPort, _ := net.SplitHostPort(localAddr)
ipBytes := net.ParseIP(localHost).To4()
if ipBytes == nil {
ipBytes = net.ParseIP("127.0.0.1").To4()
}
nPort, _ := strconv.Atoi(localPort)
reply = append(reply, ipBytes...)
portBytes := make([]byte, 2)
Expand Down