Why the snowflake server need know client IP address?

Discuss pieces:

@WofWca Why track user sessions need know client’s IP?
Seems turbotunnel use clientID(session identifier) to track user sessions not use client’s IP address.
https://www.bamsoftware.com/papers/turbotunnel/#sec:implementing

1 Like

There is this comment:

// Store a short-term mapping from the ClientID to the client IP
// address attached to this WebSocket connection. tor will want us to
// provide a client IP address when we call pt.DialOr. But a KCP session
// does not necessarily correspond to any single IP address--it's
// composed of packets that are carried in possibly multiple WebSocket
// streams. We apply the heuristic that the IP address of the most
// recent WebSocket connection that has had to do with a session, at the
// time the session is established, is the IP address that should be
// credited for the entire KCP session.
clientIDAddrMap.Set(clientID, addr)

Apparently it’s Tor that wants the IP address, and not KCP.

The map is later used here, and then the address is passed to pt.DialOrWithDialer() here.

But I don’t know if Tor requires this. In the commit that I mentioned, you can see the // TODO: This is where we need to provide the client IP address. comment. There DialOr() is called without an IP address. I don’t know if it worked back then.

2 Likes