Add v2ray QUIC transport

This commit is contained in:
世界 2022-08-22 21:20:05 +08:00
parent 77c98fd042
commit d4b7e221f0
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
22 changed files with 336 additions and 25 deletions

View file

@ -10,6 +10,7 @@ type _V2RayTransportOptions struct {
Type string `json:"type,omitempty"`
GRPCOptions V2RayGRPCOptions `json:"-"`
WebsocketOptions V2RayWebsocketOptions `json:"-"`
QUICOptions V2RayQUICOptions `json:"-"`
}
type V2RayTransportOptions _V2RayTransportOptions
@ -23,6 +24,8 @@ func (o V2RayTransportOptions) MarshalJSON() ([]byte, error) {
v = o.GRPCOptions
case C.V2RayTransportTypeWebsocket:
v = o.WebsocketOptions
case C.V2RayTransportTypeQUIC:
v = o.QUICOptions
default:
return nil, E.New("unknown transport type: " + o.Type)
}
@ -38,6 +41,10 @@ func (o *V2RayTransportOptions) UnmarshalJSON(bytes []byte) error {
switch o.Type {
case C.V2RayTransportTypeGRPC:
v = &o.GRPCOptions
case C.V2RayTransportTypeWebsocket:
v = &o.WebsocketOptions
case C.V2RayTransportTypeQUIC:
v = &o.QUICOptions
default:
return E.New("unknown transport type: " + o.Type)
}
@ -102,3 +109,5 @@ type V2RayWebsocketOptions struct {
MaxEarlyData uint32 `json:"max_early_data,omitempty"`
EarlyDataHeaderName string `json:"early_data_header_name,omitempty"`
}
type V2RayQUICOptions struct{}