Files
sing-box-extended-mirror/adapter/handler.go
T

36 lines
858 B
Go
Raw Normal View History

2022-07-01 19:34:02 +08:00
package adapter
import (
"context"
"net"
"github.com/sagernet/sing/common/buf"
2024-10-21 23:38:34 +08:00
M "github.com/sagernet/sing/common/metadata"
2022-07-01 19:34:02 +08:00
N "github.com/sagernet/sing/common/network"
)
2022-07-05 13:23:47 +08:00
type ConnectionHandler interface {
2026-04-24 08:54:40 +08:00
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
2022-07-01 19:34:02 +08:00
}
2022-07-05 13:23:47 +08:00
type PacketHandler interface {
2026-04-24 08:54:40 +08:00
NewPacket(buffer *buf.Buffer, source M.Socksaddr)
2022-07-01 19:34:02 +08:00
}
2026-04-24 08:54:40 +08:00
type PacketBatchHandler interface {
NewPacketBatch(buffers []*buf.Buffer, sources []M.Socksaddr)
2024-10-21 23:38:34 +08:00
}
2022-07-15 08:42:02 +08:00
type OOBPacketHandler interface {
2026-04-24 08:54:40 +08:00
NewPacket(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
2024-10-21 23:38:34 +08:00
}
2022-07-05 13:23:47 +08:00
type PacketConnectionHandler interface {
2026-04-24 08:54:40 +08:00
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
2022-07-01 19:34:02 +08:00
}
2022-07-05 13:23:47 +08:00
type UpstreamHandlerAdapter interface {
2024-10-21 23:38:34 +08:00
N.TCPConnectionHandlerEx
N.UDPConnectionHandlerEx
}