Add OpenVPN, TrustTunnel, Sudoku, inbound managers. Fixes

This commit is contained in:
Shtorm
2026-06-04 01:47:50 +03:00
parent 9b3da79c32
commit 195a33379d
164 changed files with 16665 additions and 1332 deletions

12
include/openvpn.go Normal file
View File

@@ -0,0 +1,12 @@
//go:build with_openvpn
package include
import (
"github.com/sagernet/sing-box/adapter/outbound"
"github.com/sagernet/sing-box/protocol/openvpn"
)
func registerOpenVPNOutbound(registry *outbound.Registry) {
openvpn.RegisterOutbound(registry)
}

20
include/openvpn_stub.go Normal file
View File

@@ -0,0 +1,20 @@
//go:build !with_openvpn
package include
import (
"context"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/adapter/outbound"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
)
func registerOpenVPNOutbound(registry *outbound.Registry) {
outbound.Register[option.OpenVPNOutboundOptions](registry, C.TypeOpenVPN, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.OpenVPNOutboundOptions) (adapter.Outbound, error) {
return nil, E.New(`OpenVPN outbound is not included in this build, rebuild with -tags with_openvpn`)
})
}

View File

@@ -31,6 +31,7 @@ import (
"github.com/sagernet/sing-box/protocol/limiter/rate"
"github.com/sagernet/sing-box/protocol/limiter/traffic"
"github.com/sagernet/sing-box/protocol/mieru"
"github.com/sagernet/sing-box/protocol/mixed"
"github.com/sagernet/sing-box/protocol/naive"
"github.com/sagernet/sing-box/protocol/parser"
@@ -83,10 +84,12 @@ func InboundRegistry() *inbound.Registry {
bond.RegisterInbound(registry)
failover.RegisterInbound(registry)
registerTrustTunnelInbound(registry)
registerQUICInbounds(registry)
registerStubForRemovedInbounds(registry)
registerMTProxyInbound(registry)
registerSudokuInbound(registry)
return registry
}
@@ -115,9 +118,11 @@ func OutboundRegistry() *outbound.Registry {
mieru.RegisterOutbound(registry)
anytls.RegisterOutbound(registry)
registerMASQUEOutbound(registry)
registerOpenVPNOutbound(registry)
bond.RegisterOutbound(registry)
failover.RegisterOutbound(registry)
registerTrustTunnelOutbound(registry)
bandwidth.RegisterOutbound(registry)
connection.RegisterOutbound(registry)
@@ -128,6 +133,7 @@ func OutboundRegistry() *outbound.Registry {
registerQUICOutbounds(registry)
registerStubForRemovedOutbounds(registry)
registerSudokuOutbound(registry)
return registry
}

17
include/sudoku.go Normal file
View File

@@ -0,0 +1,17 @@
//go:build with_sudoku
package include
import (
"github.com/sagernet/sing-box/adapter/inbound"
"github.com/sagernet/sing-box/adapter/outbound"
"github.com/sagernet/sing-box/protocol/sudoku"
)
func registerSudokuInbound(registry *inbound.Registry) {
sudoku.RegisterInbound(registry)
}
func registerSudokuOutbound(registry *outbound.Registry) {
sudoku.RegisterOutbound(registry)
}

27
include/sudoku_stub.go Normal file
View File

@@ -0,0 +1,27 @@
//go:build !with_sudoku
package include
import (
"context"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/adapter/inbound"
"github.com/sagernet/sing-box/adapter/outbound"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
)
func registerSudokuInbound(registry *inbound.Registry) {
inbound.Register[option.SudokuInboundOptions](registry, C.TypeSudoku, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.SudokuInboundOptions) (adapter.Inbound, error) {
return nil, E.New(`Sudoku is not included in this build, rebuild with -tags with_sudoku`)
})
}
func registerSudokuOutbound(registry *outbound.Registry) {
outbound.Register[option.SudokuOutboundOptions](registry, C.TypeSudoku, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.SudokuOutboundOptions) (adapter.Outbound, error) {
return nil, E.New(`Sudoku is not included in this build, rebuild with -tags with_sudoku`)
})
}

17
include/trusttunnel.go Normal file
View File

@@ -0,0 +1,17 @@
//go:build with_trusttunnel
package include
import (
"github.com/sagernet/sing-box/adapter/inbound"
"github.com/sagernet/sing-box/adapter/outbound"
"github.com/sagernet/sing-box/protocol/trusttunnel"
)
func registerTrustTunnelInbound(registry *inbound.Registry) {
trusttunnel.RegisterInbound(registry)
}
func registerTrustTunnelOutbound(registry *outbound.Registry) {
trusttunnel.RegisterOutbound(registry)
}

View File

@@ -0,0 +1,27 @@
//go:build !with_trusttunnel
package include
import (
"context"
"github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/adapter/inbound"
"github.com/sagernet/sing-box/adapter/outbound"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions"
)
func registerTrustTunnelInbound(registry *inbound.Registry) {
inbound.Register[option.TrustTunnelInboundOptions](registry, C.TypeTrustTunnel, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.TrustTunnelInboundOptions) (adapter.Inbound, error) {
return nil, E.New(`TrustTunnel is not included in this build, rebuild with -tags with_trusttunnel`)
})
}
func registerTrustTunnelOutbound(registry *outbound.Registry) {
outbound.Register[option.TrustTunnelOutboundOptions](registry, C.TypeTrustTunnel, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.TrustTunnelOutboundOptions) (adapter.Outbound, error) {
return nil, E.New(`TrustTunnel is not included in this build, rebuild with -tags with_trusttunnel`)
})
}