2022-09-14 12:46:02 +08:00
|
|
|
//go:build !with_quic
|
|
|
|
|
|
|
|
package include
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2024-11-02 00:39:02 +08:00
|
|
|
"io"
|
|
|
|
"net/http"
|
2022-09-14 12:46:02 +08:00
|
|
|
|
2022-09-26 19:37:06 +08:00
|
|
|
"github.com/sagernet/sing-box/adapter"
|
2024-11-02 00:39:02 +08:00
|
|
|
"github.com/sagernet/sing-box/adapter/inbound"
|
|
|
|
"github.com/sagernet/sing-box/adapter/outbound"
|
|
|
|
"github.com/sagernet/sing-box/common/listener"
|
2022-09-26 19:37:06 +08:00
|
|
|
"github.com/sagernet/sing-box/common/tls"
|
|
|
|
C "github.com/sagernet/sing-box/constant"
|
2024-11-02 00:39:02 +08:00
|
|
|
"github.com/sagernet/sing-box/log"
|
2022-09-26 19:37:06 +08:00
|
|
|
"github.com/sagernet/sing-box/option"
|
2024-11-02 00:39:02 +08:00
|
|
|
"github.com/sagernet/sing-box/protocol/naive"
|
2022-09-26 19:37:06 +08:00
|
|
|
"github.com/sagernet/sing-box/transport/v2ray"
|
2022-09-14 12:46:02 +08:00
|
|
|
"github.com/sagernet/sing-dns"
|
2024-10-21 23:38:34 +08:00
|
|
|
"github.com/sagernet/sing/common/logger"
|
2022-09-26 19:37:06 +08:00
|
|
|
M "github.com/sagernet/sing/common/metadata"
|
2022-09-14 12:46:02 +08:00
|
|
|
N "github.com/sagernet/sing/common/network"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
2024-02-09 18:37:25 +08:00
|
|
|
dns.RegisterTransport([]string{"quic", "h3"}, func(options dns.TransportOptions) (dns.Transport, error) {
|
2022-09-26 19:37:06 +08:00
|
|
|
return nil, C.ErrQUICNotIncluded
|
2022-09-14 12:46:02 +08:00
|
|
|
})
|
2022-09-26 19:37:06 +08:00
|
|
|
v2ray.RegisterQUICConstructor(
|
2024-10-21 23:38:34 +08:00
|
|
|
func(ctx context.Context, logger logger.ContextLogger, options option.V2RayQUICOptions, tlsConfig tls.ServerConfig, handler adapter.V2RayServerTransportHandler) (adapter.V2RayServerTransport, error) {
|
2022-09-26 19:37:06 +08:00
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
},
|
|
|
|
func(ctx context.Context, dialer N.Dialer, serverAddr M.Socksaddr, options option.V2RayQUICOptions, tlsConfig tls.Config) (adapter.V2RayClientTransport, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
},
|
|
|
|
)
|
2022-09-14 12:46:02 +08:00
|
|
|
}
|
2024-11-02 00:39:02 +08:00
|
|
|
|
|
|
|
func registerQUICInbounds(registry *inbound.Registry) {
|
|
|
|
inbound.Register[option.HysteriaInboundOptions](registry, C.TypeHysteria, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.HysteriaInboundOptions) (adapter.Inbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
inbound.Register[option.TUICInboundOptions](registry, C.TypeTUIC, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.TUICInboundOptions) (adapter.Inbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
inbound.Register[option.Hysteria2InboundOptions](registry, C.TypeHysteria2, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.Hysteria2InboundOptions) (adapter.Inbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
naive.ConfigureHTTP3ListenerFunc = func(listener *listener.Listener, handler http.Handler, tlsConfig tls.ServerConfig, logger logger.Logger) (io.Closer, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func registerQUICOutbounds(registry *outbound.Registry) {
|
|
|
|
outbound.Register[option.HysteriaOutboundOptions](registry, C.TypeHysteria, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.HysteriaOutboundOptions) (adapter.Outbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
outbound.Register[option.TUICOutboundOptions](registry, C.TypeTUIC, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.TUICOutboundOptions) (adapter.Outbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
outbound.Register[option.Hysteria2OutboundOptions](registry, C.TypeHysteria2, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.Hysteria2OutboundOptions) (adapter.Outbound, error) {
|
|
|
|
return nil, C.ErrQUICNotIncluded
|
|
|
|
})
|
|
|
|
}
|