File tree 1 file changed +9
-1
lines changed
1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ type Impl struct {
83
83
// TODO(bradfitz): provide mechanism for tsnet to reject a
84
84
// port other than accepting it and closing it.
85
85
ForwardTCPIn func (c net.Conn , port uint16 )
86
+ // ForwardTCPSockOpts, if non-nil, allows setting gvisor socket options on the
87
+ // created TCPConn before calling ForwardTCPIn.
88
+ ForwardTCPSockOpts func (port uint16 ) []tcpip.SettableSocketOption
86
89
87
90
// ProcessLocalIPs is whether netstack should handle incoming
88
91
// traffic directed at the Node.Addresses (local IPs).
@@ -900,7 +903,12 @@ func (ns *Impl) acceptTCP(r *tcp.ForwarderRequest) {
900
903
}
901
904
902
905
if ns .ForwardTCPIn != nil {
903
- c := createConn ()
906
+ opts := []tcpip.SettableSocketOption {}
907
+ if ns .ForwardTCPSockOpts != nil {
908
+ opts = ns .ForwardTCPSockOpts (reqDetails .LocalPort )
909
+ }
910
+
911
+ c := createConn (opts ... )
904
912
if c == nil {
905
913
return
906
914
}
You can’t perform that action at this time.
0 commit comments