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

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

Merged
merged 7 commits into from
Jan 31, 2025

Conversation

sbruens
Copy link

@sbruens sbruens commented Jan 30, 2025

cmd/outline-ss-server/main.go Outdated Show resolved Hide resolved
cmd/outline-ss-server/main.go Outdated Show resolved Hide resolved
cmd/outline-ss-server/main.go Outdated Show resolved Hide resolved
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

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
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.

cmd/outline-ss-server/main.go Outdated Show resolved Hide resolved
@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
5 checks passed
@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