mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-05-25 13:47:41 +03:00
refactor: DNS
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
"github.com/sagernet/sing/common/logger"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
"github.com/sagernet/sing/service"
|
||||
)
|
||||
|
||||
func RegisterOutbound(registry *outbound.Registry) {
|
||||
@@ -22,14 +23,14 @@ func RegisterOutbound(registry *outbound.Registry) {
|
||||
|
||||
type Outbound struct {
|
||||
outbound.Adapter
|
||||
router adapter.Router
|
||||
router adapter.DNSRouter
|
||||
logger logger.ContextLogger
|
||||
}
|
||||
|
||||
func NewOutbound(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.StubOptions) (adapter.Outbound, error) {
|
||||
return &Outbound{
|
||||
Adapter: outbound.NewAdapter(C.TypeDNS, tag, []string{N.NetworkTCP, N.NetworkUDP}, nil),
|
||||
router: router,
|
||||
router: service.FromContext[adapter.DNSRouter](ctx),
|
||||
logger: logger,
|
||||
}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user