-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
56 lines (47 loc) · 1.36 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from CDMFrp import FrpcClient
from CDMFrp import FrpsClient
from CDMFrp.logger import setup_logger
#客户端
if __name__ == '__main__':
logger = setup_logger(level="debug", log_file='frpc.log')
# 示例:使用配置文件
frpc_with_file = FrpcClient(config_path='/path/to/your/config.toml')
frpc_with_file.start()
# 示例:使用代码中定义的配置
frpc_with_code = FrpcClient(
server_addr='0.0.0.0:7000',
token='your_token',
user='your_user',
admin_addr=7400,
admin_user='admin_user',
admin_pwd='admin_pwd'
)
frpc_with_code.start()
try:
input("按任意键停止...\n")
finally:
frpc_with_file.stop()
frpc_with_code.stop()
#服务端
logger = setup_logger( level="DEBUG", log_file='frps.log')
# 使用配置文件初始化 FRPS 服务端
frps_with_file = FrpsClient(config_path='frps.toml')
frps_with_file.start()
# 使用代码中定义的配置初始化 FRPS 服务端
frps_with_code = FrpsClient(
bind_port=7000,
token='your_token',
dashboard_addr='0.0.0.0',
dashboard_port=7500,
dashboard_user='admin_user',
dashboard_pwd='admin_pwd',
log_file='./frps.log',
log_level='info',
log_max_days=3
)
frps_with_code.start()
try:
input("按任意键停止...\n")
finally:
frps_with_file.stop()
frps_with_code.stop()