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
# -*- coding:utf-8 -*-
import copy
def __originConfig(proxyInfo: dict) -> list:
return [
'client',
@ -36,6 +38,12 @@ def load(proxyInfo: dict, socksPort: int, configFile: str) -> tuple[list, str or
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 = [
'brook',
'--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节点合法性检查

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':
return TrojanGo.trojanGoFilter(raw, isExtra)
elif raw['type'] == 'brook':
return Brook.brookFilter(raw, isExtra)
return Brook.filte(raw, isExtra)
else:
return False, 'Unknown proxy type'
except:

Loading…
Cancel
Save