adjust vpn config, adjust retry config
This commit is contained in:
@@ -143,7 +143,7 @@ for index, server in enumerate(servers):
|
||||
with open(ovpn_filepath, "w") as f:
|
||||
f.write(DEFAULT_OVPN_CONFIG.format(server_ip=server_ip, server_cn=server_name))
|
||||
|
||||
# Establish VPN connection
|
||||
# Establish VPN connection
|
||||
connection_successful, connection_message = establish_vpn_connection(
|
||||
ovpn_filepath, CREDENTIAL_FILE, LOG_FILE, debug_print=debug_print
|
||||
)
|
||||
@@ -170,7 +170,6 @@ for index, server in enumerate(servers):
|
||||
print(f"{datetime.datetime.now()} [{index+1}/{server_count}] [{server_name}]: VPN connection failed to establish.")
|
||||
else:
|
||||
print(f"{datetime.datetime.now()} [{index+1}/{server_count}] [{server_name}]: Error starting OpenVPN connection: {connection_message}")
|
||||
|
||||
# Disconnect VPN
|
||||
disconnect_vpn()
|
||||
print(f"{datetime.datetime.now()} [{index+1}/{server_count}] [{server_name}]: VPN disconnected.")
|
||||
|
||||
@@ -17,8 +17,7 @@ def establish_vpn_connection(ovpn_file, credential_file, log_file, debug_print=N
|
||||
|
||||
# Establish VPN connection (capture stdout and stderr)
|
||||
openvpn_command = ["/usr/sbin/openvpn", "--config", ovpn_file,
|
||||
"--auth-user-pass", credential_file,
|
||||
"--verb", "1"]
|
||||
"--auth-user-pass", credential_file, "--verb", "1"]
|
||||
|
||||
if debug_print:
|
||||
debug_print(f"OpenVPN command: {' '.join(openvpn_command)}") # Debug print
|
||||
|
||||
@@ -4,7 +4,7 @@ client
|
||||
dev tun
|
||||
proto tcp
|
||||
remote {server_ip} 443
|
||||
resolv-retry infinite
|
||||
resolv-retry 3
|
||||
remote-random
|
||||
nobind
|
||||
tun-mtu 1500
|
||||
@@ -12,9 +12,7 @@ tun-mtu-extra 32
|
||||
mssfix 1450
|
||||
persist-key
|
||||
persist-tun
|
||||
ping 15
|
||||
ping-restart 0
|
||||
ping-timer-rem
|
||||
connect-retry-max 1
|
||||
reneg-sec 0
|
||||
comp-lzo no
|
||||
verify-x509-name CN={server_cn}
|
||||
@@ -22,7 +20,6 @@ remote-cert-tls server
|
||||
auth-user-pass
|
||||
verb 3
|
||||
pull
|
||||
fast-io
|
||||
cipher AES-256-CBC
|
||||
auth SHA512
|
||||
<ca>
|
||||
|
||||
Reference in New Issue
Block a user