mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 08:31:30 +00:00
29 lines
673 B
Go
29 lines
673 B
Go
package adapter
|
|
|
|
import (
|
|
"context"
|
|
"net"
|
|
|
|
"github.com/sagernet/sing/common/buf"
|
|
E "github.com/sagernet/sing/common/exceptions"
|
|
N "github.com/sagernet/sing/common/network"
|
|
)
|
|
|
|
type ConnectionHandler interface {
|
|
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
|
|
}
|
|
|
|
type PacketHandler interface {
|
|
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata InboundContext) error
|
|
}
|
|
|
|
type PacketConnectionHandler interface {
|
|
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
|
|
}
|
|
|
|
type UpstreamHandlerAdapter interface {
|
|
N.TCPConnectionHandler
|
|
N.UDPConnectionHandler
|
|
E.Handler
|
|
}
|