Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Jrohy committed Nov 15, 2021
1 parent 0d90581 commit b9157f2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
3 changes: 2 additions & 1 deletion v2ray_util/json_template/server.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"network": "",
"kcpSettings": {},
"tcpSettings": {},
"quicSettings": {}
"quicSettings": {},
"grpcSettings": {}
}
}
],
Expand Down
20 changes: 7 additions & 13 deletions v2ray_util/util_core/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,6 @@ def to_kcp(self, header_type):
type_str = "wireguard"
self.part_json["streamSettings"]["kcpSettings"]["header"]["type"] = type_str

def to_vmess(self):
self.part_json["protocol"] = "vmess"
self.part_json["settings"] = {
"clients": [
{
"alterId": 0,
"id": str(uuid.uuid1())
}
]
}

def write(self, **kw):
security_backup, tls_settings_backup, origin_protocol, domain = "", "", None, ""
no_tls_group = (StreamType.MTPROTO, StreamType.SS)
Expand Down Expand Up @@ -168,9 +157,15 @@ def write(self, **kw):
if origin_protocol == StreamType.MTPROTO and origin_protocol != self.stream_type:
clean_mtproto_tag(self.config, self.group_index)

server = self.load_template('server.json')
server["inbounds"][0]["port"] = self.part_json["port"]
server["inbounds"][0]["settings"]["clients"][0]["id"] = str(uuid.uuid1())
if "allocate" in self.part_json:
server["inbounds"][0]["allocate"] = self.part_json["allocate"]
self.part_json = server["inbounds"][0]

if "KCP" in self.stream_type.name:
self.to_kcp(self.stream_type.value)
self.to_vmess()

elif self.stream_type == StreamType.TCP:
self.part_json["streamSettings"] = self.load_template('tcp.json')
Expand Down Expand Up @@ -218,7 +213,6 @@ def write(self, **kw):
self.part_json["streamSettings"] = ws

elif self.stream_type == StreamType.GRPC:
self.to_vmess()
alpn = ["h2"]
self.part_json["streamSettings"] = self.load_template('tcp.json')
self.part_json["streamSettings"]["network"] = "grpc"
Expand Down

0 comments on commit b9157f2

Please sign in to comment.