Skip to content

Commit

Permalink
Fix PEP errors & fixed issue #21 properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Sinclair committed Oct 4, 2019
1 parent b723b01 commit 5af0c12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
16 changes: 7 additions & 9 deletions stun/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,10 @@


def _initialize():
items = list(dictAttrToVal.items())
for i in range(len(items)):
dictValToAttr.update({items[i][1]: items[i][0]})
items = list(dictMsgTypeToVal.items())
for i in range(len(items)):
dictValToMsgType.update({items[i][1]: items[i][0]})
for attr, value in dictAttrToVal.items():
dictValToAttr[value] = attr
for msg_type, value in dictMsgTypeToVal.items():
dictValToMsgType[value] = msg_type


def gen_tran_id():
Expand Down Expand Up @@ -191,9 +189,9 @@ def get_nat_type(s, source_ip, source_port, stun_host=None, stun_port=3478):
ret = stun_test(s, stun_host, port, source_ip, source_port)
resp = ret['Resp']
else:
for stun_host in stun_servers_list:
log.debug('Trying STUN host: %s', stun_host)
ret = stun_test(s, stun_host, port, source_ip, source_port)
for stun_server in stun_servers_list:
log.debug('Trying STUN host: %s', stun_server)
ret = stun_test(s, stun_server, port, source_ip, source_port)
resp = ret['Resp']
if resp:
break
Expand Down
1 change: 1 addition & 0 deletions stun/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@ def main():
except KeyboardInterrupt:
sys.exit()


if __name__ == '__main__':
main()

0 comments on commit 5af0c12

Please sign in to comment.