def correct_header(self, header, auth, sock, **kw):
try:
buf = sock.getsockopt(socket.SOL_IP, SO_ORIGINAL_DST, 16)
assert len(buf) == 16
remote = (socket.inet_ntoa(buf[4:8]), int.from_bytes(buf[2:4], 'big'))
assert sock.getsockname() != remote
except Exception:
return False
return auth and header == auth[:1] or not auth
评论列表
文章目录