mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-31 08:24:24 +03:00
Add resolver for inbound
This commit is contained in:
@@ -2,8 +2,11 @@ package adapter
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/netip"
|
||||
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
)
|
||||
|
||||
type Inbound interface {
|
||||
@@ -23,8 +26,10 @@ type InboundContext struct {
|
||||
|
||||
// cache
|
||||
|
||||
DomainStrategy C.DomainStrategy
|
||||
SniffEnabled bool
|
||||
SniffOverrideDestination bool
|
||||
DestinationAddresses []netip.Addr
|
||||
|
||||
SourceGeoIPCode string
|
||||
GeoIPCode string
|
||||
@@ -50,5 +55,5 @@ func AppendContext(ctx context.Context) (context.Context, *InboundContext) {
|
||||
return ctx, metadata
|
||||
}
|
||||
metadata = new(InboundContext)
|
||||
return WithContext(ctx, metadata), nil
|
||||
return WithContext(ctx, metadata), metadata
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
)
|
||||
|
||||
@@ -13,6 +12,6 @@ type Outbound interface {
|
||||
Tag() string
|
||||
Network() []string
|
||||
N.Dialer
|
||||
NewConnection(ctx context.Context, conn net.Conn, destination M.Socksaddr) error
|
||||
NewPacketConnection(ctx context.Context, conn N.PacketConn, destination M.Socksaddr) error
|
||||
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
||||
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user