Skip to content

Commit

Permalink
fix bug cannot connect to TCP network
Browse files Browse the repository at this point in the history
  • Loading branch information
sijms committed Nov 23, 2020
1 parent 5249e77 commit bf464c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions network/redirect_packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (pck *RedirectPacket) findValue(key string) string {
return ""
}
end = start + end
substr := redirectAddr[start:end]
substr := pck.redirectAddr[start:end]
words := strings.Split(substr, "=")
if len(words) == 2 {
return strings.TrimSpace(words[1])
Expand All @@ -70,7 +70,7 @@ func (pck *RedirectPacket) findValue(key string) string {
}
}
func (pck *RedirectPacket) protocol() string {
return pck.findValue("PROTOCOL")
return strings.ToLower(pck.findValue("PROTOCOL"))
}

func (pck *RedirectPacket) host() string {
Expand Down
8 changes: 4 additions & 4 deletions network/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ func (session *Session) Connect() error {
return errors.New("redirect packet with wrong port")
}
}
err = session.conn.Close()
if err != nil {
return errors.New("cannot close existing connection")
}
//err = session.conn.Close()
//if err != nil {
// return errors.New("cannot close existing connection")
//}
return session.Connect()
}
return errors.New("connection refused by the server")
Expand Down

0 comments on commit bf464c1

Please sign in to comment.