github.com/ipfans/trojan-go@v0.11.0/tunnel/tproxy/tunnel.go (about)

     1  //go:build linux
     2  // +build linux
     3  
     4  package tproxy
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/ipfans/trojan-go/tunnel"
    10  )
    11  
    12  const Name = "TPROXY"
    13  
    14  type Tunnel struct{}
    15  
    16  func (t *Tunnel) Name() string {
    17  	return Name
    18  }
    19  
    20  func (t *Tunnel) NewClient(ctx context.Context, client tunnel.Client) (tunnel.Client, error) {
    21  	panic("not supported")
    22  }
    23  
    24  func (t *Tunnel) NewServer(ctx context.Context, server tunnel.Server) (tunnel.Server, error) {
    25  	return NewServer(ctx, server)
    26  }
    27  
    28  func init() {
    29  	tunnel.RegisterTunnel(Name, &Tunnel{})
    30  }