Skip to content

Commit

Permalink
Fix StreamConn wrapper.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Dec 4, 2024
1 parent c0e942b commit 6eb828e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions cmd/outline-ss-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 6eb828e

Please sign in to comment.