2022-08-22 10:53:47 +00:00
|
|
|
package adapter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"net"
|
2023-02-12 21:53:03 +00:00
|
|
|
|
|
|
|
E "github.com/sagernet/sing/common/exceptions"
|
|
|
|
N "github.com/sagernet/sing/common/network"
|
2022-08-22 10:53:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type V2RayServerTransport interface {
|
2022-08-22 13:20:05 +00:00
|
|
|
Network() []string
|
2022-08-22 10:53:47 +00:00
|
|
|
Serve(listener net.Listener) error
|
2022-08-22 13:20:05 +00:00
|
|
|
ServePacket(listener net.PacketConn) error
|
2022-08-22 10:53:47 +00:00
|
|
|
Close() error
|
|
|
|
}
|
|
|
|
|
2023-02-12 21:53:03 +00:00
|
|
|
type V2RayServerTransportHandler interface {
|
|
|
|
N.TCPConnectionHandler
|
|
|
|
E.Handler
|
|
|
|
}
|
|
|
|
|
2022-08-22 10:53:47 +00:00
|
|
|
type V2RayClientTransport interface {
|
|
|
|
DialContext(ctx context.Context) (net.Conn, error)
|
|
|
|
}
|