@@ -101,6 +101,12 @@ def DRVCF(args):
101101 run_as_root (args )
102102#end define
103103
104+ def get_own_ip ():
105+ requests .packages .urllib3 .util .connection .HAS_IPV6 = False
106+ ip = requests .get ("https://ifconfig.me/ip" ).text
107+ return ip
108+ #end define
109+
104110def GetLiteServerConfig ():
105111 keys_dir = local .buffer .keys_dir
106112 liteserver_key = keys_dir + "liteserver"
@@ -110,7 +116,7 @@ def GetLiteServerConfig():
110116 data = file .read ()
111117 file .close ()
112118 key = base64 .b64encode (data [4 :])
113- ip = requests . get ( "https://ifconfig.me" ). text
119+ ip = get_own_ip ()
114120 mconfig = GetConfig (path = local .buffer .mconfig_path )
115121 result .ip = ip2int (ip )
116122 result .port = mconfig .liteClient .liteServer .port
@@ -278,7 +284,7 @@ def FirstNodeSettings():
278284 add2systemd (name = "validator" , user = vuser , start = cmd ) # post="/usr/bin/python3 /usr/src/mytonctrl/mytoncore.py -e \"validator down\""
279285
280286 # Получить внешний ip адрес
281- ip = requests . get ( "https://ifconfig.me" ). text
287+ ip = get_own_ip ()
282288 vport = random .randint (2000 , 65000 )
283289 addr = "{ip}:{vport}" .format (ip = ip , vport = vport )
284290 local .add_log ("Use addr: " + addr , "debug" )
@@ -682,7 +688,7 @@ def DangerousRecoveryValidatorConfigFile():
682688 # Create addrs object
683689 buff = Dict ()
684690 buff ["@type" ] = "engine.addr"
685- buff .ip = ip2int (requests . get ( "https://ifconfig.me" ). text )
691+ buff .ip = ip2int (get_own_ip () )
686692 buff .port = None
687693 buff .categories = [0 , 1 , 2 , 3 ]
688694 buff .priority_categories = []
@@ -934,7 +940,7 @@ def EnableDhtServer():
934940 add2systemd (name = "dht-server" , user = vuser , start = cmd )
935941
936942 # Получить внешний ip адрес
937- ip = requests . get ( "https://ifconfig.me" ). text
943+ ip = get_own_ip ()
938944 port = random .randint (2000 , 65000 )
939945 addr = "{ip}:{port}" .format (ip = ip , port = port )
940946
0 commit comments