39 lines
1.0 KiB
Go
39 lines
1.0 KiB
Go
package sbproxy
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"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"
|
|
"github.com/sagernet/sing/common"
|
|
M "github.com/sagernet/sing/common/metadata"
|
|
)
|
|
|
|
func RegisterOutbound(registry *outbound.Registry) {
|
|
outbound.Register[option.SBProxyOutboundOptions](registry, C.TypeSBProxy, NewOutbound)
|
|
}
|
|
|
|
type Outbound struct {
|
|
outbound.Adapter
|
|
ctx context.Context
|
|
logger log.ContextLogger
|
|
options option.SBProxyOutboundOptions
|
|
}
|
|
|
|
func NewOutbound(ctx context.Context, logger log.ContextLogger, tag string, options option.SBProxyOutboundOptions) (adapter.Outbound, error) {
|
|
return &Outbound{
|
|
Adapter: outbound.NewAdapter(C.TypeSBProxy, tag),
|
|
ctx: ctx,
|
|
logger: logger,
|
|
options: options,
|
|
}, nil
|
|
}
|
|
|
|
func (h *Outbound) DialContext(ctx context.Context, network string, destination M.Metadata) (net.Conn, error) {
|
|
return nil, common.ErrNotImplemented
|
|
}
|