Skip to content

Commit

Permalink
Fix passing addresses with PROXY protocol (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevapple authored Aug 27, 2024
1 parent 13832fc commit 1486234
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sshmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func (s *Server) Handshake(session *ssh.PipeSession) error {
return err
}
if upstream.ProxyProtocol > 0 {
header := proxyproto.HeaderProxyFromAddrs(upstream.ProxyProtocol, session.Downstream.RemoteAddr(), nil)
header := proxyproto.HeaderProxyFromAddrs(upstream.ProxyProtocol, session.Downstream.RemoteAddr(), conn.RemoteAddr())
_, err := header.WriteTo(conn)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion sshmux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func initUpstreamProxyServer() {
log.Fatal(err)
}
// 2. Send PROXY header to sshmux
header := proxyproto.HeaderProxyFromAddrs(2, conn.RemoteAddr(), nil)
header := proxyproto.HeaderProxyFromAddrs(2, conn.RemoteAddr(), sshmux.RemoteAddr())
_, err = header.WriteTo(sshmux)
if err != nil {
log.Fatal(err)
Expand Down

0 comments on commit 1486234

Please sign in to comment.