Add naiveproxy outbound

This commit is contained in:
世界
2025-12-12 15:02:08 +08:00
parent 7e68013b05
commit ad7b982242
27 changed files with 1521 additions and 135 deletions

12
include/naive_outbound.go Normal file
View File

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

View File

@@ -0,0 +1,20 @@
//go:build !with_naive_outbound
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 registerNaiveOutbound(registry *outbound.Registry) {
outbound.Register[option.NaiveOutboundOptions](registry, C.TypeNaive, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.NaiveOutboundOptions) (adapter.Outbound, error) {
return nil, E.New(`naive outbound is not included in this build, rebuild with -tags with_naive_outbound`)
})
}

View File

@@ -86,6 +86,7 @@ func OutboundRegistry() *outbound.Registry {
shadowsocks.RegisterOutbound(registry)
vmess.RegisterOutbound(registry)
trojan.RegisterOutbound(registry)
registerNaiveOutbound(registry)
tor.RegisterOutbound(registry)
ssh.RegisterOutbound(registry)
shadowtls.RegisterOutbound(registry)