github.com/ipfans/trojan-go@v0.11.0/tunnel/dokodemo/tunnel.go (about) 1 package dokodemo 2 3 import ( 4 "context" 5 6 "github.com/ipfans/trojan-go/common" 7 "github.com/ipfans/trojan-go/tunnel" 8 ) 9 10 const Name = "DOKODEMO" 11 12 type Tunnel struct{ tunnel.Tunnel } 13 14 func (*Tunnel) Name() string { 15 return Name 16 } 17 18 func (*Tunnel) NewServer(ctx context.Context, underlay tunnel.Server) (tunnel.Server, error) { 19 return NewServer(ctx, underlay) 20 } 21 22 func (*Tunnel) NewClient(ctx context.Context, underlay tunnel.Client) (tunnel.Client, error) { 23 return nil, common.NewError("not supported") 24 } 25 26 func init() { 27 tunnel.RegisterTunnel(Name, &Tunnel{}) 28 }