mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-06-08 12:14:54 +03:00
Add NDIS inbound
This commit is contained in:
12
include/ndis.go
Normal file
12
include/ndis.go
Normal file
@@ -0,0 +1,12 @@
|
||||
//go:build windows && with_gvisor
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"github.com/sagernet/sing-box/adapter/inbound"
|
||||
"github.com/sagernet/sing-box/protocol/ndis"
|
||||
)
|
||||
|
||||
func registerNDISInbound(registry *inbound.Registry) {
|
||||
ndis.RegisterInbound(registry)
|
||||
}
|
||||
20
include/ndis_nongvisor_stub.go
Normal file
20
include/ndis_nongvisor_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build windows && !with_gvisor
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/inbound"
|
||||
C "github.com/sagernet/sing-box/constant"
|
||||
"github.com/sagernet/sing-box/log"
|
||||
"github.com/sagernet/sing-box/option"
|
||||
"github.com/sagernet/sing-tun"
|
||||
)
|
||||
|
||||
func registerNDISInbound(registry *inbound.Registry) {
|
||||
inbound.Register[option.NDISInboundOptions](registry, C.TypeNDIS, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.NDISInboundOptions) (adapter.Inbound, error) {
|
||||
return nil, tun.ErrGVisorNotIncluded
|
||||
})
|
||||
}
|
||||
20
include/ndis_nonwindows_stub.go
Normal file
20
include/ndis_nonwindows_stub.go
Normal file
@@ -0,0 +1,20 @@
|
||||
//go:build !windows
|
||||
|
||||
package include
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
"github.com/sagernet/sing-box/adapter/inbound"
|
||||
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 registerNDISInbound(registry *inbound.Registry) {
|
||||
inbound.Register[option.NDISInboundOptions](registry, C.TypeNDIS, func(ctx context.Context, router adapter.Router, logger log.ContextLogger, tag string, options option.NDISInboundOptions) (adapter.Inbound, error) {
|
||||
return nil, E.New("NDIS is only supported in windows")
|
||||
})
|
||||
}
|
||||
@@ -51,6 +51,7 @@ func InboundRegistry() *inbound.Registry {
|
||||
|
||||
registerQUICInbounds(registry)
|
||||
registerStubForRemovedInbounds(registry)
|
||||
registerNDISInbound(registry)
|
||||
|
||||
return registry
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user