mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-14 12:53:17 +00:00
33 lines
824 B
Go
33 lines
824 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 OOBPacketHandler interface {
|
|
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, oob []byte, 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
|
|
}
|