chore: restful api display smux and mptcp
Some checks failed
Trigger CMFA Update / trigger-CMFA-update (push) Has been cancelled

This commit is contained in:
Chenx Dust 2024-11-12 07:58:24 +00:00 committed by Hellojack
parent 792f16265e
commit de19f927e8
5 changed files with 32 additions and 0 deletions

View File

@ -165,6 +165,8 @@ func (p *Proxy) MarshalJSON() ([]byte, error) {
mapping["udp"] = p.SupportUDP() mapping["udp"] = p.SupportUDP()
mapping["xudp"] = p.SupportXUDP() mapping["xudp"] = p.SupportXUDP()
mapping["tfo"] = p.SupportTFO() mapping["tfo"] = p.SupportTFO()
mapping["mptcp"] = p.SupportMPTCP()
mapping["smux"] = p.SupportSMUX()
return json.Marshal(mapping) return json.Marshal(mapping)
} }

View File

@ -95,6 +95,16 @@ func (b *Base) SupportTFO() bool {
return b.tfo return b.tfo
} }
// SupportMPTCP implements C.ProxyAdapter
func (b *Base) SupportMPTCP() bool {
return b.mpTcp
}
// SupportSMUX implements C.ProxyAdapter
func (b *Base) SupportSMUX() bool {
return false
}
// IsL3Protocol implements C.ProxyAdapter // IsL3Protocol implements C.ProxyAdapter
func (b *Base) IsL3Protocol(metadata *C.Metadata) bool { func (b *Base) IsL3Protocol(metadata *C.Metadata) bool {
return false return false

View File

@ -97,6 +97,10 @@ func (s *SingMux) SupportUOT() bool {
return true return true
} }
func (s *SingMux) SupportSMUX() bool {
return true
}
func closeSingMux(s *SingMux) { func closeSingMux(s *SingMux) {
_ = s.client.Close() _ = s.client.Close()
} }

View File

@ -625,6 +625,20 @@ func (r *refProxyAdapter) SupportTFO() bool {
return false return false
} }
func (r *refProxyAdapter) SupportMPTCP() bool {
if r.proxyAdapter != nil {
return r.proxyAdapter.SupportMPTCP()
}
return false
}
func (r *refProxyAdapter) SupportSMUX() bool {
if r.proxyAdapter != nil {
return r.proxyAdapter.SupportSMUX()
}
return false
}
func (r *refProxyAdapter) MarshalJSON() ([]byte, error) { func (r *refProxyAdapter) MarshalJSON() ([]byte, error) {
if r.proxyAdapter != nil { if r.proxyAdapter != nil {
return r.proxyAdapter.MarshalJSON() return r.proxyAdapter.MarshalJSON()

View File

@ -106,6 +106,8 @@ type ProxyAdapter interface {
SupportUDP() bool SupportUDP() bool
SupportXUDP() bool SupportXUDP() bool
SupportTFO() bool SupportTFO() bool
SupportMPTCP() bool
SupportSMUX() bool
MarshalJSON() ([]byte, error) MarshalJSON() ([]byte, error)
// Deprecated: use DialContextWithDialer and ListenPacketWithDialer instead. // Deprecated: use DialContextWithDialer and ListenPacketWithDialer instead.