Browse Source

Chore(core/adapter): rename to TransportHandler

pull/133/head
xjasonlyu 3 years ago
parent
commit
ba7a7ddc95
  1. 4
      core/adapter/handler.go
  2. 2
      core/stack.go
  3. 2
      engine/tunnel.go

4
core/adapter/handler.go

@ -1,8 +1,8 @@
package adapter
// Handler is a TCP/UDP connection handler that implements
// TransportHandler is a TCP/UDP connection handler that implements
// HandleTCPConn and HandleUDPConn methods.
type Handler interface {
type TransportHandler interface {
HandleTCP(TCPConn)
HandleUDP(UDPConn)
}

2
core/stack.go

@ -14,7 +14,7 @@ import (
)
// CreateStackWithOptions creates *stack.Stack with given options.
func CreateStackWithOptions(linkEP stack.LinkEndpoint, handler adapter.Handler, opts ...option.Option) (*stack.Stack, error) {
func CreateStackWithOptions(linkEP stack.LinkEndpoint, handler adapter.TransportHandler, opts ...option.Option) (*stack.Stack, error) {
s := stack.New(stack.Options{
NetworkProtocols: []stack.NetworkProtocolFactory{
ipv4.NewProtocol,

2
engine/tunnel.go

@ -5,7 +5,7 @@ import (
"github.com/xjasonlyu/tun2socks/v2/tunnel"
)
var _ adapter.Handler = (*fakeTunnel)(nil)
var _ adapter.TransportHandler = (*fakeTunnel)(nil)
type fakeTunnel struct{}

Loading…
Cancel
Save