Skip to content

Commit

Permalink
Refactor RelayNode model to use 'remotes' instead of 'tcp_remotes'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 committed Aug 30, 2024
1 parent b2a7976 commit e48d659
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions apps/proxy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,7 @@ def get_config(self):
for rule in rules:
# NOTE 这里要求代理节点的隧道监听类型一致
nodes: List[ProxyNode] = rule.proxy_nodes.all()
tcp_remotes = []
remotes = []
for proxy_node in nodes:
if not proxy_node.enable:
continue
Expand All @@ -701,20 +701,20 @@ def get_config(self):
tcp_remote = f"ws://{tcp_remote}"
elif rule.transport_type == c.TRANSPORT_WSS:
tcp_remote = f"wss://{tcp_remote}"
tcp_remotes.append(tcp_remote)
rule_cfg = {
"label": rule.name,
"listen": f"0.0.0.0:{rule.relay_port}",
"listen_type": rule.listen_type,
"transport_type": rule.transport_type,
"tcp_remotes": tcp_remotes,
"remotes": tcp_remotes,
"options": {
"enable_multipath_tcp": True,
"enable_udp": rule.enable_udp and proxy_node.enable_udp,
},
}
relay_configs.append(rule_cfg)
remotes.append(tcp_remote)
rule_cfg = {
"label": rule.name,
"listen": f"0.0.0.0:{rule.relay_port}",
"listen_type": rule.listen_type,
"transport_type": rule.transport_type,
"remotes": remotes,
"options": {
"enable_multipath_tcp": True,
"enable_udp": rule.enable_udp and proxy_node.enable_udp,
},
}
relay_configs.append(rule_cfg)

cfg = {
"enable_ping": self.enable_ping,
"relay_configs": relay_configs,
Expand Down

0 comments on commit e48d659

Please sign in to comment.