Browse Source

fix UDP source port issue

master
clowwindy 5 years ago
parent
commit
c34c99450f
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      shadowsocks/udprelay.py

+ 3
- 3
shadowsocks/udprelay.py View File

@@ -76,8 +76,8 @@ from shadowsocks.common import parse_header, pack_addr
BUF_SIZE = 65536


def client_key(a, b, c, d):
return '%s:%s:%s:%s' % (a, b, c, d)
def client_key(source_addr, dest_addr):
return '%s:%s' % (source_addr[0], source_addr[1])


class UDPRelay(object):
@@ -169,7 +169,7 @@ class UDPRelay(object):
else:
server_addr, server_port = dest_addr, dest_port

key = client_key(r_addr[0], r_addr[1], dest_addr, dest_port)
key = client_key(r_addr, (dest_addr, dest_port))
client = self._cache.get(key, None)
if not client:
# TODO async getaddrinfo

Loading…
Cancel
Save