Add Support for QUIC Protocol in VLESS (#1473)

This commit is contained in:
Deni 2024-08-18 16:57:40 +03:00 committed by GitHub
parent bc7f85cf98
commit 2e1a6bc814
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 45 additions and 1 deletions

View File

@ -93,6 +93,7 @@
<option value="ws">WebSocket</option>
<option value="h2">HTTP/2</option>
<option value="grpc">gRPC</option>
<option value="quic">QUIC</option>
</b-select>
</b-field>
<b-field v-show="v2ray.net === 'tcp'" label="Type" label-position="on-border">
@ -105,7 +106,14 @@
</option>
</b-select>
</b-field>
<b-field v-show="v2ray.net === 'kcp'" label="Type" label-position="on-border">
<b-field v-show="v2ray.protocol === 'vless' && v2ray.net == 'quic'" label="QUIC Security" label-position="on-border">
<b-select v-model="v2ray.quicSecurity" expanded>
<option value="none">none</option>
<option value="aes-128-gcm">aes-128-gcm</option>
<option value="chacha20-poly1305">chacha20-poly1305</option>
</b-select>
</b-field>
<b-field v-show="v2ray.net === 'kcp' || v2ray.net === 'quic'" label="Type" label-position="on-border">
<b-select v-model="v2ray.type" expanded>
<option value="none">
{{ $t("configureServer.noObfuscation") }}
@ -153,6 +161,10 @@
<b-field v-show="v2ray.net === 'grpc'" label="Service Name" label-position="on-border">
<b-input ref="v2ray_service_name" v-model="v2ray.path" type="text" expanded />
</b-field>
<b-field v-show="v2ray.net === 'quic'" label="Key" label-position="on-border">
<b-input ref="v2ray_key" v-model="v2ray.key" :placeholder="$t('configureServer.password')"
expanded />
</b-field>
</b-tab-item>
<b-tab-item label="SS">
<b-field label="Name" label-position="on-border">
@ -603,6 +615,7 @@ export default {
host: "",
path: "",
tls: "none",
quicSecurity: "none",
fp: "",
pbk: "",
sid: "",
@ -612,6 +625,7 @@ export default {
v: "",
allowInsecure: false,
protocol: "vmess",
key: "none",
},
ss: {
method: "aes-128-gcm",
@ -808,11 +822,13 @@ export default {
alpn: u.params.alpn || "",
sni: u.params.sni || "",
tls: u.params.security || "none",
quicSecurity: u.params.quicSecurity || "none",
fp: u.params.fp || "",
pbk: u.params.pbk || "",
sid: u.params.sid || "",
spx: u.params.spx || "",
allowInsecure: u.params.allowInsecure || false,
key: u.params.key,
protocol: "vless",
};
if (o.alpn !== "") {
@ -1052,6 +1068,10 @@ export default {
if (srcObj.net === "mkcp" || srcObj.net === "kcp") {
query.seed = srcObj.path;
}
if (srcObj.net === "quic") {
query.key = srcObj.key;
query.quicSecurity = srcObj.quicSecurity;
}
if (query.security == "reality") {
query.pbk = srcObj.pbk;
query.sid = srcObj.sid;

View File

@ -149,6 +149,7 @@ type StreamSettings struct {
WsSettings *WsSettings `json:"wsSettings,omitempty"`
HTTPSettings *HttpSettings `json:"httpSettings,omitempty"`
GrpcSettings *GrpcSettings `json:"grpcSettings,omitempty"`
QuicSettings *QuicSettings `json:"quicSettings,omitempty"`
Sockopt *Sockopt `json:"sockopt,omitempty"`
}
type RealitySettings struct {
@ -245,6 +246,11 @@ type HttpSettings struct {
Host []string `json:"host,omitempty"`
Method string `json:"method,omitempty"`
}
type QuicSettings struct {
Header KcpHeader `json:"header"`
Key string `json:"key,omitempty"`
Security string `json:"security"`
}
type Hosts map[string][]string
type DNS struct {

View File

@ -50,6 +50,8 @@ type V2Ray struct {
Flow string `json:"flow,omitempty"`
Alpn string `json:"alpn,omitempty"`
AllowInsecure bool `json:"allowInsecure"`
Key string `json:"key,omitempty"`
QuicSecurity string `json:"quicSecurity"`
V string `json:"v"`
Protocol string `json:"protocol"`
}
@ -87,6 +89,7 @@ func ParseVlessURL(vless string) (data *V2Ray, err error) {
Flow: u.Query().Get("flow"),
Alpn: u.Query().Get("alpn"),
AllowInsecure: u.Query().Get("allowInsecure") == "true",
Key: u.Query().Get("key"),
V: vless,
Protocol: "vless",
}
@ -108,6 +111,9 @@ func ParseVlessURL(vless string) (data *V2Ray, err error) {
if data.Net == "mkcp" || data.Net == "kcp" {
data.Path = u.Query().Get("seed")
}
if data.Net == "quic" {
data.QuicSecurity = u.Query().Get("quicSecurity")
}
return data, nil
}
@ -355,6 +361,14 @@ func (v *V2Ray) Configuration(info PriorInfo) (c Configuration, err error) {
Path: v.Path,
}
}
case "quic":
core.StreamSettings.QuicSettings = &coreObj.QuicSettings{
Header: coreObj.KcpHeader{
Type: v.Type,
},
Key: v.Key,
Security: v.QuicSecurity,
}
default:
return Configuration{}, fmt.Errorf("unexpected transport type: %v", v.Net)
}
@ -444,6 +458,10 @@ func (v *V2Ray) ExportToURL() string {
setValue(&query, "path", v.Path)
case "grpc":
setValue(&query, "serviceName", v.Path)
case "quic":
setValue(&query, "headerType", v.Type)
setValue(&query, "key", v.Key)
setValue(&query, "quicSecurity", v.QuicSecurity)
}
if v.TLS != "none" {
setValue(&query, "flow", v.Flow)