mirror of
https://github.com/SagerNet/sing-box.git
synced 2026-04-11 17:47:20 +10:00
refactor: Modular inbound/outbound manager
This commit is contained in:
@@ -23,6 +23,7 @@ import (
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
"github.com/sagernet/sing/common/task"
|
||||
"github.com/sagernet/sing/common/x/list"
|
||||
"github.com/sagernet/sing/service"
|
||||
|
||||
"github.com/insomniacslk/dhcp/dhcpv4"
|
||||
mDNS "github.com/miekg/dns"
|
||||
@@ -53,7 +54,7 @@ func NewTransport(options dns.TransportOptions) (*Transport, error) {
|
||||
if linkURL.Host == "" {
|
||||
return nil, E.New("missing interface name for DHCP")
|
||||
}
|
||||
router := adapter.RouterFromContext(options.Context)
|
||||
router := service.FromContext[adapter.Router](options.Context)
|
||||
if router == nil {
|
||||
return nil, E.New("missing router in context")
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/sagernet/sing-dns"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
"github.com/sagernet/sing/common/logger"
|
||||
"github.com/sagernet/sing/service"
|
||||
|
||||
mDNS "github.com/miekg/dns"
|
||||
)
|
||||
@@ -32,7 +33,7 @@ type Transport struct {
|
||||
}
|
||||
|
||||
func NewTransport(options dns.TransportOptions) (*Transport, error) {
|
||||
router := adapter.RouterFromContext(options.Context)
|
||||
router := service.FromContext[adapter.Router](options.Context)
|
||||
if router == nil {
|
||||
return nil, E.New("missing router in context")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user