Implement TCP and ICMP rejects

This commit is contained in:
世界
2024-10-22 21:28:22 +08:00
parent 262727ec6c
commit 4da652ff02
8 changed files with 97 additions and 43 deletions

View File

@@ -405,9 +405,15 @@ func (t *TUN) Close() error {
)
}
func (t *TUN) PrepareConnection(source M.Socksaddr, destination M.Socksaddr) error {
// TODO: implement rejects
return nil
func (t *TUN) PrepareConnection(network string, source M.Socksaddr, destination M.Socksaddr) error {
return t.router.PreMatch(adapter.InboundContext{
Inbound: t.tag,
InboundType: C.TypeTun,
Network: network,
Source: source,
Destination: destination,
InboundOptions: t.inboundOptions,
})
}
func (t *TUN) NewConnectionEx(ctx context.Context, conn net.Conn, source M.Socksaddr, destination M.Socksaddr, onClose N.CloseHandlerFunc) {