Skip to content

Commit

Permalink
chore: restful api display smux and mptcp
Browse files Browse the repository at this point in the history
  • Loading branch information
chenx-dust authored and H1JK committed Nov 14, 2024
1 parent 792f162 commit de19f92
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
2 changes: 2 additions & 0 deletions adapter/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ func (p *Proxy) MarshalJSON() ([]byte, error) {
mapping["udp"] = p.SupportUDP()
mapping["xudp"] = p.SupportXUDP()
mapping["tfo"] = p.SupportTFO()
mapping["mptcp"] = p.SupportMPTCP()
mapping["smux"] = p.SupportSMUX()
return json.Marshal(mapping)
}

Expand Down
10 changes: 10 additions & 0 deletions adapter/outbound/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ func (b *Base) SupportTFO() bool {
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
func (b *Base) IsL3Protocol(metadata *C.Metadata) bool {
return false
Expand Down
4 changes: 4 additions & 0 deletions adapter/outbound/singmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ func (s *SingMux) SupportUOT() bool {
return true
}

func (s *SingMux) SupportSMUX() bool {
return true
}

func closeSingMux(s *SingMux) {
_ = s.client.Close()
}
Expand Down
14 changes: 14 additions & 0 deletions adapter/outbound/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,20 @@ func (r *refProxyAdapter) SupportTFO() bool {
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) {
if r.proxyAdapter != nil {
return r.proxyAdapter.MarshalJSON()
Expand Down
2 changes: 2 additions & 0 deletions constant/adapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ type ProxyAdapter interface {
SupportUDP() bool
SupportXUDP() bool
SupportTFO() bool
SupportMPTCP() bool
SupportSMUX() bool
MarshalJSON() ([]byte, error)

// Deprecated: use DialContextWithDialer and ListenPacketWithDialer instead.
Expand Down

0 comments on commit de19f92

Please sign in to comment.