@@ -37,25 +37,23 @@ var (
3737type icmpProxy struct {
3838 srcFunnelTracker * packet.FunnelTracker
3939 listenIP netip.Addr
40- ipv6Zone string
4140 logger * zerolog.Logger
4241 idleTimeout time.Duration
4342}
4443
45- func newICMPProxy (listenIP netip.Addr , zone string , logger * zerolog.Logger , idleTimeout time.Duration ) (* icmpProxy , error ) {
46- if err := testPermission (listenIP , zone , logger ); err != nil {
44+ func newICMPProxy (listenIP netip.Addr , logger * zerolog.Logger , idleTimeout time.Duration ) (* icmpProxy , error ) {
45+ if err := testPermission (listenIP , logger ); err != nil {
4746 return nil , err
4847 }
4948 return & icmpProxy {
5049 srcFunnelTracker : packet .NewFunnelTracker (),
5150 listenIP : listenIP ,
52- ipv6Zone : zone ,
5351 logger : logger ,
5452 idleTimeout : idleTimeout ,
5553 }, nil
5654}
5755
58- func testPermission (listenIP netip.Addr , zone string , logger * zerolog.Logger ) error {
56+ func testPermission (listenIP netip.Addr , logger * zerolog.Logger ) error {
5957 // Opens a non-privileged ICMP socket. On Linux the group ID of the process needs to be in ping_group_range
6058 // Only check ping_group_range once for IPv4
6159 if listenIP .Is4 () {
@@ -64,7 +62,7 @@ func testPermission(listenIP netip.Addr, zone string, logger *zerolog.Logger) er
6462 return err
6563 }
6664 }
67- conn , err := newICMPConn (listenIP , zone )
65+ conn , err := newICMPConn (listenIP )
6866 if err != nil {
6967 return err
7068 }
@@ -98,9 +96,9 @@ func checkInPingGroup() error {
9896 return fmt .Errorf ("did not find group range in %s" , pingGroupPath )
9997}
10098
101- func (ip * icmpProxy ) Request (ctx context.Context , pk * packet.ICMP , responder * packetResponder ) error {
102- ctx , span := responder .requestSpan (ctx , pk )
103- defer responder .exportSpan ()
99+ func (ip * icmpProxy ) Request (ctx context.Context , pk * packet.ICMP , responder ICMPResponder ) error {
100+ ctx , span := responder .RequestSpan (ctx , pk )
101+ defer responder .ExportSpan ()
104102
105103 originalEcho , err := getICMPEcho (pk .Message )
106104 if err != nil {
@@ -109,9 +107,9 @@ func (ip *icmpProxy) Request(ctx context.Context, pk *packet.ICMP, responder *pa
109107 }
110108 observeICMPRequest (ip .logger , span , pk .Src .String (), pk .Dst .String (), originalEcho .ID , originalEcho .Seq )
111109
112- shouldReplaceFunnelFunc := createShouldReplaceFunnelFunc (ip .logger , responder . datagramMuxer , pk , originalEcho .ID )
110+ shouldReplaceFunnelFunc := createShouldReplaceFunnelFunc (ip .logger , responder , pk , originalEcho .ID )
113111 newFunnelFunc := func () (packet.Funnel , error ) {
114- conn , err := newICMPConn (ip .listenIP , ip . ipv6Zone )
112+ conn , err := newICMPConn (ip .listenIP )
115113 if err != nil {
116114 tracing .EndWithErrorStatus (span , err )
117115 return nil , errors .Wrap (err , "failed to open ICMP socket" )
@@ -127,7 +125,7 @@ func (ip *icmpProxy) Request(ctx context.Context, pk *packet.ICMP, responder *pa
127125 span .SetAttributes (attribute .Int ("port" , localUDPAddr .Port ))
128126
129127 echoID := localUDPAddr .Port
130- icmpFlow := newICMPEchoFlow (pk .Src , closeCallback , conn , responder , echoID , originalEcho .ID , packet . NewEncoder () )
128+ icmpFlow := newICMPEchoFlow (pk .Src , closeCallback , conn , responder , echoID , originalEcho .ID )
131129 return icmpFlow , nil
132130 }
133131 funnelID := flow3Tuple {
@@ -181,8 +179,8 @@ func (ip *icmpProxy) listenResponse(ctx context.Context, flow *icmpEchoFlow) {
181179
182180// Listens for ICMP response and handles error logging
183181func (ip * icmpProxy ) handleResponse (ctx context.Context , flow * icmpEchoFlow , buf []byte ) (done bool ) {
184- _ , span := flow .responder .replySpan (ctx , ip .logger )
185- defer flow .responder .exportSpan ()
182+ _ , span := flow .responder .ReplySpan (ctx , ip .logger )
183+ defer flow .responder .ExportSpan ()
186184
187185 span .SetAttributes (
188186 attribute .Int ("originalEchoID" , flow .originalEchoID ),
0 commit comments