Skip to content

Commit

Permalink
Expose net.UDPConn.File functionality for the Conjure DTLS transport
Browse files Browse the repository at this point in the history
  • Loading branch information
rod-hynes committed Nov 13, 2023
1 parent 847bfea commit a9d0f0a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions psiphon/common/refraction/refraction.go
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,19 @@ type managedConn struct {
manager *dialManager
}

type fileConn interface {
File() (*os.File, error)
}

// File exposes the net.UDPConn.File() functionality required by the Conjure
// DTLS transport.
func (conn *managedConn) File() (*os.File, error) {
if f, ok := conn.Conn.(fileConn); ok {
return f.File()
}
return nil, errors.TraceNew("underlying conn is not a fileConn")
}

// CloseWrite exposes the net.TCPConn.CloseWrite() functionality
// required by TapDance.
func (conn *managedConn) CloseWrite() error {
Expand Down

0 comments on commit a9d0f0a

Please sign in to comment.