File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454with open (__dir__ / "config.json" ) as f :
5555 con = load (f )
5656
57- def getMyIPAddress ():
58- global __ip__
59- if __ip__ :
60- return __ip__
61- with suppress (Exception ):
62- return get ('https://api.my-ip.io/ip' , timeout = .1 ).text
63- with suppress (Exception ):
64- return get ('https://ipwhois.app/json/' , timeout = .1 ).json ()["ip" ]
65- with suppress (Exception ):
66- return get ('https://ipinfo.io/json' , timeout = .1 ).json ()["ip" ]
67- with suppress (Exception ):
68- return ProxyTools .Patterns .IP .search (get ('http://checkip.dyndns.org/' , timeout = .1 ).text )
69- with suppress (Exception ):
70- return ProxyTools .Patterns .IP .search (get ('https://spaceiran.com/myip/' , timeout = .1 ).text )
71- with suppress (Exception ):
72- return get ('https://ip.42.pl/raw' , timeout = .1 ).text
73- return getMyIPAddress ()
57+ with socket (AF_INET , SOCK_DGRAM ) as s :
58+ s .connect (("8.8.8.8" , 80 ))
59+ __ip__ = s .getsockname ()[0 ]
7460
7561
7662class bcolors :
You can’t perform that action at this time.
0 commit comments