不息屏
This commit is contained in:
+2
-1
@@ -1,4 +1,5 @@
|
||||
[proxy]
|
||||
|
||||
# 目标服务器配置
|
||||
# 协议支持: http, https
|
||||
# protocol = https
|
||||
@@ -13,4 +14,4 @@ target_port = 443
|
||||
# 另一个备用配置
|
||||
# protocol = http
|
||||
# target_host = 192.168.1.100
|
||||
# target_port = 8080
|
||||
# target_port = 8080
|
||||
@@ -4,6 +4,7 @@ import sys
|
||||
import configparser
|
||||
import os
|
||||
|
||||
|
||||
def load_config(config_path='config.ini'):
|
||||
"""加载配置文件"""
|
||||
config = configparser.ConfigParser()
|
||||
@@ -43,6 +44,7 @@ def load_config(config_path='config.ini'):
|
||||
|
||||
def handle_request(sock, target_host, target_port):
|
||||
"""处理从A设备收到的请求,转发到目标网站"""
|
||||
|
||||
try:
|
||||
# 接收来自A设备的请求
|
||||
request = b""
|
||||
@@ -102,8 +104,10 @@ def connect_to_a_device(a_host, a_port, target_host, target_port):
|
||||
time.sleep(3)
|
||||
|
||||
def main():
|
||||
|
||||
# 加载配置
|
||||
config = load_config()
|
||||
|
||||
|
||||
# 解析命令行参数
|
||||
if len(sys.argv) < 3:
|
||||
|
||||
Reference in New Issue
Block a user