From 6eb828ef5b3f50903e5c08262ce92442e7c13933 Mon Sep 17 00:00:00 2001 From: sbruens Date: Wed, 4 Dec 2024 13:27:35 -0500 Subject: [PATCH] Fix StreamConn wrapper. --- cmd/outline-ss-server/main.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/outline-ss-server/main.go b/cmd/outline-ss-server/main.go index 6c213377..9a5faab1 100644 --- a/cmd/outline-ss-server/main.go +++ b/cmd/outline-ss-server/main.go @@ -305,7 +305,7 @@ func (s *OutlineServer) runConfig(config Config) (func() error, error) { w.WriteHeader(http.StatusBadGateway) return } - conn := &wsToStreamConn{&wrappedConn{Conn: wsConn, raddr: raddr}} + conn := &streamConn{&wrappedConn{Conn: wsConn, raddr: raddr}} ssService.HandleStream(ctx, conn) } websocket.Handler(handler).ServeHTTP(w, r) @@ -418,19 +418,18 @@ func (c wrappedConn) RemoteAddr() net.Addr { return c.raddr } -// wsToStreamConn converts a [websocket.Conn] to a [transport.StreamConn]. -type wsToStreamConn struct { +type streamConn struct { net.Conn } -var _ transport.StreamConn = (*wsToStreamConn)(nil) +var _ transport.StreamConn = (*streamConn)(nil) -func (c wsToStreamConn) CloseRead() error { +func (c *streamConn) CloseRead() error { return c.Close() } -func (c wsToStreamConn) CloseWrite() error { - return nil +func (c *streamConn) CloseWrite() error { + return c.Close() } func main() {