Skip to content

refactor: use the SDK's WebSocket Upgrade() function#234

Merged
sbruens merged 7 commits into
masterfrom
sbruens/gorilla-ws
Jan 31, 2025
Merged

refactor: use the SDK's WebSocket Upgrade() function#234
sbruens merged 7 commits into
masterfrom
sbruens/gorilla-ws

Conversation

@sbruens

@sbruens sbruens commented Jan 30, 2025

Copy link
Copy Markdown

Comment thread cmd/outline-ss-server/main.go Outdated
Comment thread cmd/outline-ss-server/main.go Outdated
Comment thread cmd/outline-ss-server/main.go Outdated
Comment thread cmd/outline-ss-server/main.go Outdated
defer wsConn.Close()
ctx, contextCancel := context.WithCancel(context.Background())
defer contextCancel()
conn := &replaceAddrConn{StreamConn: websocket.WrapConn(wsConn), raddr: &net.TCPAddr{IP: net.ParseIP(r.RemoteAddr)}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't wsConn already have the right remote address because of handlers.ProxyHeaders?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, handlers.ProxyHeaders only moves the client IP into the request's RemoteAddr. The wsConn.RemoteAddr() is not altered.

Comment thread cmd/outline-ss-server/main.go Outdated
@sbruens sbruens force-pushed the sbruens/gorilla-ws branch from 2aa225f to a41761c Compare January 30, 2025 16:22
@sbruens sbruens requested a review from fortuna January 30, 2025 16:22
@sbruens sbruens marked this pull request as ready for review January 30, 2025 16:22
@sbruens sbruens requested a review from a team as a code owner January 30, 2025 16:22
@sbruens sbruens changed the title refactor: implement WebSocket handlers with Gorilla refactor: implement WebSocket handlers using the SDK's Upgrade() func Jan 30, 2025
@sbruens sbruens changed the title refactor: implement WebSocket handlers using the SDK's Upgrade() func refactor: use the SDK's WebSocket Upgrade() function Jan 30, 2025
@sbruens sbruens merged commit 0387dfb into master Jan 31, 2025
@sbruens sbruens deleted the sbruens/gorilla-ws branch January 31, 2025 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants