Add resolved service and DNS server

This commit is contained in:
世界 2025-03-30 23:34:15 +08:00
parent e9b73cba5a
commit a812e92cce
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
24 changed files with 1413 additions and 58 deletions

View file

@ -34,6 +34,7 @@ import (
"github.com/sagernet/sing-box/protocol/tun"
"github.com/sagernet/sing-box/protocol/vless"
"github.com/sagernet/sing-box/protocol/vmess"
"github.com/sagernet/sing-box/service/resolved"
E "github.com/sagernet/sing/common/exceptions"
)
@ -111,6 +112,7 @@ func DNSTransportRegistry() *dns.TransportRegistry {
hosts.RegisterTransport(registry)
local.RegisterTransport(registry)
fakeip.RegisterTransport(registry)
resolved.RegisterTransport(registry)
registerQUICTransports(registry)
registerDHCPTransport(registry)
@ -122,16 +124,13 @@ func DNSTransportRegistry() *dns.TransportRegistry {
func ServiceRegistry() *service.Registry {
registry := service.NewRegistry()
resolved.RegisterService(registry)
registerDERPService(registry)
return registry
}
func ServiceRegistry() *service.Registry {
registry := service.NewRegistry()
return registry
}
func registerStubForRemovedInbounds(registry *inbound.Registry) {
inbound.Register[option.ShadowsocksInboundOptions](registry, C.TypeShadowsocksR, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.ShadowsocksInboundOptions) (adapter.Inbound, error) {
return nil, E.New("ShadowsocksR is deprecated and removed in sing-box 1.6.0")