feat: add linsters
This commit is contained in:
@ -13,3 +13,29 @@ type AdvanceListener interface {
|
||||
Config() string
|
||||
HandleConn(conn net.Conn, in chan<- ConnContext)
|
||||
}
|
||||
|
||||
type NewListener interface {
|
||||
Name() string
|
||||
ReCreate(tcpIn chan<- ConnContext,udpIn chan<-*PacketAdapter) error
|
||||
Close() error
|
||||
Address() string
|
||||
RawAddress() string
|
||||
}
|
||||
|
||||
// PacketAdapter is a UDP Packet adapter for socks/redir/tun
|
||||
type PacketAdapter struct {
|
||||
UDPPacket
|
||||
metadata *Metadata
|
||||
}
|
||||
|
||||
func NewPacketAdapter(udppacket UDPPacket,metadata *Metadata)*PacketAdapter{
|
||||
return &PacketAdapter{
|
||||
udppacket,
|
||||
metadata,
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata returns destination metadata
|
||||
func (s *PacketAdapter) Metadata() *Metadata {
|
||||
return s.metadata
|
||||
}
|
@ -117,21 +117,23 @@ func (t Type) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// Metadata is used to store connection address
|
||||
type Metadata struct {
|
||||
NetWork NetWork `json:"network"`
|
||||
Type Type `json:"type"`
|
||||
SrcIP netip.Addr `json:"sourceIP"`
|
||||
DstIP netip.Addr `json:"destinationIP"`
|
||||
SrcPort string `json:"sourcePort"`
|
||||
DstPort string `json:"destinationPort"`
|
||||
InIP netip.Addr `json:"inboundIP"`
|
||||
InPort string `json:"inboundPort"`
|
||||
Host string `json:"host"`
|
||||
DNSMode DNSMode `json:"dnsMode"`
|
||||
Uid *uint32 `json:"uid"`
|
||||
Process string `json:"process"`
|
||||
ProcessPath string `json:"processPath"`
|
||||
SpecialProxy string `json:"specialProxy"`
|
||||
RemoteDst string `json:"remoteDestination"`
|
||||
NetWork NetWork `json:"network"`
|
||||
Type Type `json:"type"`
|
||||
SrcIP netip.Addr `json:"sourceIP"`
|
||||
DstIP netip.Addr `json:"destinationIP"`
|
||||
SrcPort string `json:"sourcePort"`
|
||||
DstPort string `json:"destinationPort"`
|
||||
InIP netip.Addr `json:"inboundIP"`
|
||||
InPort string `json:"inboundPort"`
|
||||
Host string `json:"host"`
|
||||
DNSMode DNSMode `json:"dnsMode"`
|
||||
Uid *uint32 `json:"uid"`
|
||||
Process string `json:"process"`
|
||||
ProcessPath string `json:"processPath"`
|
||||
SpecialProxy string `json:"specialProxy"`
|
||||
RemoteDst string `json:"remoteDestination"`
|
||||
InName string `jsson:"-"`
|
||||
PreferRulesName string
|
||||
}
|
||||
|
||||
func (m *Metadata) RemoteAddress() string {
|
||||
|
Reference in New Issue
Block a user