mirror of https://github.com/huashengdun/webssh
Added get_addr to get real client addr
parent
e64ffe978b
commit
5d0fad48ec
10
main.py
10
main.py
|
@ -206,8 +206,16 @@ class WsockHandler(tornado.websocket.WebSocketHandler):
|
|||
def check_origin(self, origin):
|
||||
return True
|
||||
|
||||
def get_addr(self):
|
||||
ip = self.request.headers.get_list('X-Real-Ip')
|
||||
port = self.request.headers.get_list('X-Real-Port')
|
||||
addr = ':'.join(ip + port)
|
||||
if not addr:
|
||||
addr = '{}:{}'.format(*self.stream.socket.getpeername())
|
||||
return addr
|
||||
|
||||
def open(self):
|
||||
self.src_addr = '{}:{}'.format(*self.stream.socket.getpeername())
|
||||
self.src_addr = self.get_addr()
|
||||
logging.info('Connected from {}'.format(self.src_addr))
|
||||
worker = workers.pop(self.get_argument('id'), None)
|
||||
if not worker:
|
||||
|
|
Loading…
Reference in New Issue