Update goWeb with new state fields

This commit is contained in:
Andy Wang 2019-12-29 19:47:17 +00:00
parent 65553f4ec4
commit 2acc174a05
1 changed files with 5 additions and 2 deletions

View File

@ -40,8 +40,11 @@ func dispatchConnection(conn net.Conn, sta *server.State) {
data := buf[:i]
goWeb := func() {
_, remotePort, _ := net.SplitHostPort(conn.LocalAddr().String())
webConn, err := net.Dial("tcp", net.JoinHostPort(sta.RedirAddr.String(), remotePort))
redirPort := sta.RedirPort
if redirPort == "" {
_, redirPort, _ = net.SplitHostPort(conn.LocalAddr().String())
}
webConn, err := net.Dial("tcp", net.JoinHostPort(sta.RedirHost.String(), redirPort))
if err != nil {
log.Errorf("Making connection to redirection server: %v", err)
return