chore: restful api display fast-open for tuic and hysteria
This commit is contained in:
parent
5c8ffc98c9
commit
4f1c2dfbaa
5 changed files with 13 additions and 3 deletions
|
@ -92,6 +92,7 @@ func (p *Proxy) MarshalJSON() ([]byte, error) {
|
|||
mapping["history"] = p.DelayHistory()
|
||||
mapping["name"] = p.Name()
|
||||
mapping["udp"] = p.SupportUDP()
|
||||
mapping["tfo"] = p.SupportTFO()
|
||||
return json.Marshal(mapping)
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ type Base struct {
|
|||
iface string
|
||||
tp C.AdapterType
|
||||
udp bool
|
||||
tfo bool
|
||||
rmark int
|
||||
id string
|
||||
prefer C.DNSPrefer
|
||||
|
@ -76,6 +77,11 @@ func (b *Base) SupportUDP() bool {
|
|||
return b.udp
|
||||
}
|
||||
|
||||
// SupportTFO implements C.ProxyAdapter
|
||||
func (b *Base) SupportTFO() bool {
|
||||
return b.tfo
|
||||
}
|
||||
|
||||
// MarshalJSON implements C.ProxyAdapter
|
||||
func (b *Base) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(map[string]string{
|
||||
|
@ -130,6 +136,7 @@ type BaseOption struct {
|
|||
Addr string
|
||||
Type C.AdapterType
|
||||
UDP bool
|
||||
TFO bool
|
||||
Interface string
|
||||
RoutingMark int
|
||||
Prefer C.DNSPrefer
|
||||
|
@ -141,6 +148,7 @@ func NewBase(opt BaseOption) *Base {
|
|||
addr: opt.Addr,
|
||||
tp: opt.Type,
|
||||
udp: opt.UDP,
|
||||
tfo: opt.TFO,
|
||||
iface: opt.Interface,
|
||||
rmark: opt.RoutingMark,
|
||||
prefer: opt.Prefer,
|
||||
|
|
|
@ -31,11 +31,9 @@ import (
|
|||
|
||||
const (
|
||||
mbpsToBps = 125000
|
||||
minSpeedBPS = 16384
|
||||
|
||||
DefaultStreamReceiveWindow = 15728640 // 15 MB/s
|
||||
DefaultConnectionReceiveWindow = 67108864 // 64 MB/s
|
||||
DefaultMaxIncomingStreams = 1024
|
||||
|
||||
DefaultALPN = "hysteria"
|
||||
DefaultProtocol = "udp"
|
||||
|
@ -258,6 +256,7 @@ func NewHysteria(option HysteriaOption) (*Hysteria, error) {
|
|||
addr: addr,
|
||||
tp: C.Hysteria,
|
||||
udp: true,
|
||||
tfo: option.FastOpen,
|
||||
iface: option.Interface,
|
||||
rmark: option.RoutingMark,
|
||||
prefer: C.NewDNSPrefer(option.IPVersion),
|
||||
|
|
|
@ -193,6 +193,7 @@ func NewTuic(option TuicOption) (*Tuic, error) {
|
|||
addr: addr,
|
||||
tp: C.Tuic,
|
||||
udp: true,
|
||||
tfo: option.FastOpen,
|
||||
iface: option.Interface,
|
||||
prefer: C.NewDNSPrefer(option.IPVersion),
|
||||
},
|
||||
|
|
|
@ -86,6 +86,7 @@ type ProxyAdapter interface {
|
|||
Type() AdapterType
|
||||
Addr() string
|
||||
SupportUDP() bool
|
||||
SupportTFO() bool
|
||||
MarshalJSON() ([]byte, error)
|
||||
|
||||
// StreamConn wraps a protocol around net.Conn with Metadata.
|
||||
|
|
Loading…
Reference in a new issue