mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-02 07:43:36 +02:00
Add MTProxy, MASQUE, VPN, Link parser. Update AmneziaWG. Remove Tunneling
This commit is contained in:
@@ -11,3 +11,13 @@ func ContextWithIsExternalConnection(ctx context.Context) context.Context {
|
||||
func IsExternalConnectionFromContext(ctx context.Context) bool {
|
||||
return ctx.Value(contextKeyIsExternalConnection{}) != nil
|
||||
}
|
||||
|
||||
type contextKeyIsProviderConnection struct{}
|
||||
|
||||
func ContextWithIsProviderConnection(ctx context.Context) context.Context {
|
||||
return context.WithValue(ctx, contextKeyIsProviderConnection{}, true)
|
||||
}
|
||||
|
||||
func IsProviderConnectionFromContext(ctx context.Context) bool {
|
||||
return ctx.Value(contextKeyIsProviderConnection{}) != nil
|
||||
}
|
||||
|
||||
@@ -17,30 +17,31 @@ type Group struct {
|
||||
type groupConnItem struct {
|
||||
conn io.Closer
|
||||
isExternal bool
|
||||
isProvider bool
|
||||
}
|
||||
|
||||
func NewGroup() *Group {
|
||||
return &Group{}
|
||||
}
|
||||
|
||||
func (g *Group) NewConn(conn net.Conn, isExternal bool) net.Conn {
|
||||
func (g *Group) NewConn(conn net.Conn, isExternal bool, isProvider bool) net.Conn {
|
||||
g.access.Lock()
|
||||
defer g.access.Unlock()
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal})
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal, isProvider})
|
||||
return &Conn{Conn: conn, group: g, element: item}
|
||||
}
|
||||
|
||||
func (g *Group) NewPacketConn(conn net.PacketConn, isExternal bool) net.PacketConn {
|
||||
func (g *Group) NewPacketConn(conn net.PacketConn, isExternal bool, isProvider bool) net.PacketConn {
|
||||
g.access.Lock()
|
||||
defer g.access.Unlock()
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal})
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal, isProvider})
|
||||
return &PacketConn{PacketConn: conn, group: g, element: item}
|
||||
}
|
||||
|
||||
func (g *Group) NewSingPacketConn(conn N.PacketConn, isExternal bool) N.PacketConn {
|
||||
func (g *Group) NewSingPacketConn(conn N.PacketConn, isExternal bool, isProvider bool) N.PacketConn {
|
||||
g.access.Lock()
|
||||
defer g.access.Unlock()
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal})
|
||||
item := g.connections.PushBack(&groupConnItem{conn, isExternal, isProvider})
|
||||
return &SingPacketConn{PacketConn: conn, group: g, element: item}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user