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

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