Skip to content

Commit

Permalink
fixed: #231
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Oct 3, 2019
1 parent b6527bf commit d6d35bc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 13 deletions.
2 changes: 1 addition & 1 deletion v2ray_util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '3.6.5'
__version__ = '3.6.6b1'

from .util_core.trans import _
11 changes: 3 additions & 8 deletions v2ray_util/config_modify/cdn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,15 @@
from ..util_core.utils import StreamType, ColorStr, get_ip

class CDNModifier:
def __init__(self, group_tag='A', group_index=-1, domain='', fake_domain=''):
def __init__(self, group_tag='A', group_index=-1, domain=''):
self.domain = domain
self.group_tag = group_tag
self.group_index = group_index
if domain:
self.__writeWS(fake_domain)
StreamWriter(self.group_tag, self.group_index, StreamType.WS).write()

self.gw = GroupWriter(group_tag, group_index)

def __writeWS(self, fake_domain):
sw = StreamWriter(self.group_tag, self.group_index, StreamType.WS)
sw.write(**{'host': fake_domain})

def openHttp(self):
'''
cloudflare cdn proxy 80 port
Expand Down Expand Up @@ -65,7 +61,6 @@ def modify():
CDNModifier(group.tag, group.index).closeHttp()
return True

fake_domain = input(_("please input ws fake domain(enter to no need): "))
domain = input(_("please input run cdn mode domain: "))
if not domain:
print(ColorStr.yellow(_("domain is empty!")))
Expand All @@ -87,7 +82,7 @@ def modify():
print("")
return

cm = CDNModifier(group.tag, group.index, domain, fake_domain)
cm = CDNModifier(group.tag, group.index, domain)

if choice == '1':
cm.openHttp()
Expand Down
Binary file modified v2ray_util/locale_i18n/zh_CH/LC_MESSAGES/lang.mo
Binary file not shown.
3 changes: 0 additions & 3 deletions v2ray_util/locale_i18n/zh_CH/LC_MESSAGES/lang.po
Original file line number Diff line number Diff line change
Expand Up @@ -591,9 +591,6 @@ msgstr "2.443端口 + ws"
msgid "3.close cdn(80 port)"
msgstr "3.关闭cdn(80端口)"

msgid "please input ws fake domain(enter to no need): "
msgstr "请输入ws要伪装的域名(不伪装直接回车): "

msgid "please input run cdn mode domain: "
msgstr "请输入走cdn的域名: "

Expand Down
3 changes: 2 additions & 1 deletion v2ray_util/util_core/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def write(self, **kw):
ws = self.load_template('ws.json')
salt = '/' + ''.join(random.sample(string.ascii_letters + string.digits, 8)) + '/'
ws["wsSettings"]["path"] = salt
ws["wsSettings"]["headers"]["Host"] = kw['host']
if "host" in kw:
ws["wsSettings"]["headers"]["Host"] = kw['host']
self.part_json["streamSettings"] = ws

elif self.stream_type == StreamType.H2:
Expand Down

0 comments on commit d6d35bc

Please sign in to comment.