openziti / ziti-tunnel-sdk-c

Apache License 2.0
43 stars 17 forks source link

select service with closest matching address when intercepting #424

Closed scareything closed 2 years ago

scareything commented 2 years ago

The tsdk associates intercepted packets with ziti services by iterating through the available services and selecting the first service with a matching protocol, ip, and port. It would be better to score all service addresses that match the intercepted packet and select the one with the highest score.

For example, two services are being intercepted at the following addresses:

  1. tcp:192.168.0.8/32:22
  2. tcp:192.168.0.0/24:22

When a packet with dst_ip 192.168.0.8 is intercepted, the connection should be associated with service 1.

ekoby commented 2 years ago

we need to have some formula that includes the sizes of port and IP ranges