Improve OpenVPN & OpenConnect interoperability
This commit is contained in:
@@ -4,9 +4,14 @@ package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
"github.com/sagernet/sing-box/dns"
|
||||
"github.com/sagernet/sing-box/protocol/openconnect"
|
||||
)
|
||||
|
||||
func registerOpenConnectEndpoint(registry *endpoint.Registry) {
|
||||
openconnect.RegisterEndpoint(registry)
|
||||
}
|
||||
|
||||
func registerOpenConnectDNSTransport(registry *dns.TransportRegistry) {
|
||||
openconnect.RegisterDNSTransport(registry)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/dns"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
@@ -21,3 +22,9 @@ func registerOpenConnectEndpoint(registry *endpoint.Registry) {
|
||||
return nil, E.New(`OpenConnect is not included in this build, rebuild with -tags with_openconnect`)
|
||||
})
|
||||
}
|
||||
|
||||
func registerOpenConnectDNSTransport(registry *dns.TransportRegistry) {
|
||||
dns.RegisterTransport[option.OpenConnectDNSServerOptions](registry, C.DNSTypeOpenConnect, func(ctx context.Context, logger log.ContextLogger, tag string, options option.OpenConnectDNSServerOptions) (adapter.DNSTransport, error) {
|
||||
return nil, E.New(`OpenConnect is not included in this build, rebuild with -tags with_openconnect`)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -4,9 +4,14 @@ package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
"github.com/sagernet/sing-box/dns"
|
||||
"github.com/sagernet/sing-box/protocol/openvpn"
|
||||
)
|
||||
|
||||
func registerOpenVPNEndpoints(registry *endpoint.Registry) {
|
||||
openvpn.RegisterEndpoint(registry)
|
||||
}
|
||||
|
||||
func registerOpenVPNDNSTransport(registry *dns.TransportRegistry) {
|
||||
openvpn.RegisterDNSTransport(registry)
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import (
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/endpoint"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/dns"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
@@ -27,3 +28,9 @@ func registerOpenVPNEndpoints(registry *endpoint.Registry) {
|
||||
return nil, E.New(`OpenVPN is not included in this build, rebuild with -tags with_openvpn`)
|
||||
})
|
||||
}
|
||||
|
||||
func registerOpenVPNDNSTransport(registry *dns.TransportRegistry) {
|
||||
dns.RegisterTransport[option.OpenVPNDNSServerOptions](registry, C.DNSTypeOpenVPN, func(ctx context.Context, logger log.ContextLogger, tag string, options option.OpenVPNDNSServerOptions) (adapter.DNSTransport, error) {
|
||||
return nil, E.New(`OpenVPN is not included in this build, rebuild with -tags with_openvpn`)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -134,6 +134,8 @@ func DNSTransportRegistry() *dns.TransportRegistry {
|
||||
registerQUICTransports(registry)
|
||||
registerDHCPTransport(registry)
|
||||
registerTailscaleTransport(registry)
|
||||
registerOpenConnectDNSTransport(registry)
|
||||
registerOpenVPNDNSTransport(registry)
|
||||
|
||||
return registry
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user