github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/adapter/v2ray.go (about)

     1  package adapter
     2  
     3  import (
     4  	"context"
     5  	"net"
     6  
     7  	E "github.com/sagernet/sing/common/exceptions"
     8  	M "github.com/sagernet/sing/common/metadata"
     9  	N "github.com/sagernet/sing/common/network"
    10  )
    11  
    12  type V2RayServerTransport interface {
    13  	Network() []string
    14  	Serve(listener net.Listener) error
    15  	ServePacket(listener net.PacketConn) error
    16  	Close() error
    17  }
    18  
    19  type V2RayServerTransportHandler interface {
    20  	N.TCPConnectionHandler
    21  	E.Handler
    22  	FallbackConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error
    23  }
    24  
    25  type V2RayClientTransport interface {
    26  	DialContext(ctx context.Context) (net.Conn, error)
    27  }