Browse Source

fix: IPv6 for Brook server

master
Dnomd343 3 years ago
parent
commit
961e180dfb
  1. 8
      ProxyBuilder/Brook.py
  2. 2
      ProxyFilter/Brook.py
  3. 2
      ProxyFilter/filter.py

8
ProxyBuilder/Brook.py

@ -1,6 +1,8 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding:utf-8 -*- # -*- coding:utf-8 -*-
import copy
def __originConfig(proxyInfo: dict) -> list: def __originConfig(proxyInfo: dict) -> list:
return [ return [
'client', 'client',
@ -36,6 +38,12 @@ def load(proxyInfo: dict, socksPort: int, configFile: str) -> tuple[list, str or
return startCommand, fileContent, envVar return startCommand, fileContent, envVar
""" """
proxyInfo = copy.deepcopy(proxyInfo)
if proxyInfo['server'].find(':') >= 0:
proxyInfo['server'] = '[' + proxyInfo['server'] + ']' # IPv6
if proxyInfo['ws'] is not None and proxyInfo['ws']['host'].find(':') >= 0:
proxyInfo['ws']['host'] = '[' + proxyInfo['ws']['host'] + ']' # IPv6
command = [ command = [
'brook', 'brook',
'--debug', '--listen', 'skip success', # debug on '--debug', '--listen', 'skip success', # debug on

2
ProxyFilter/Brook.py

@ -67,7 +67,7 @@ brookFilterRules = {
} }
} }
def brookFilter(rawInfo: dict, isExtra: bool) -> tuple[bool, str or dict]: def filte(rawInfo: dict, isExtra: bool) -> tuple[bool, str or dict]:
""" """
Brook节点合法性检查 Brook节点合法性检查

2
ProxyFilter/filter.py

@ -39,7 +39,7 @@ def filte(raw: dict, isExtra: bool = False) -> tuple[bool, str or dict]:
elif raw['type'] == 'trojan-go': elif raw['type'] == 'trojan-go':
return TrojanGo.trojanGoFilter(raw, isExtra) return TrojanGo.trojanGoFilter(raw, isExtra)
elif raw['type'] == 'brook': elif raw['type'] == 'brook':
return Brook.brookFilter(raw, isExtra) return Brook.filte(raw, isExtra)
else: else:
return False, 'Unknown proxy type' return False, 'Unknown proxy type'
except: except:

Loading…
Cancel
Save