wireguard_stub.go 1.2 KB

123456789101112131415161718192021222324252627
  1. //go:build !with_wireguard
  2. package include
  3. import (
  4. "context"
  5. "github.com/sagernet/sing-box/adapter"
  6. "github.com/sagernet/sing-box/adapter/endpoint"
  7. "github.com/sagernet/sing-box/adapter/outbound"
  8. C "github.com/sagernet/sing-box/constant"
  9. "github.com/sagernet/sing-box/log"
  10. "github.com/sagernet/sing-box/option"
  11. E "github.com/sagernet/sing/common/exceptions"
  12. )
  13. func registerWireGuardOutbound(registry *outbound.Registry) {
  14. outbound.Register[option.LegacyWireGuardOutboundOptions](registry, C.TypeWireGuard, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.LegacyWireGuardOutboundOptions) (adapter.Outbound, error) {
  15. return nil, E.New(`WireGuard is not included in this build, rebuild with -tags with_wireguard`)
  16. })
  17. }
  18. func registerWireGuardEndpoint(registry *endpoint.Registry) {
  19. endpoint.Register[option.WireGuardEndpointOptions](registry, C.TypeWireGuard, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.WireGuardEndpointOptions) (adapter.Endpoint, error) {
  20. return nil, E.New(`WireGuard is not included in this build, rebuild with -tags with_wireguard`)
  21. })
  22. }