Implement TCP and ICMP rejects

This commit is contained in:
世界
2024-10-22 21:28:22 +08:00
parent 08d8378a1c
commit 2a4bcddbcb
6 changed files with 94 additions and 40 deletions

View File

@@ -404,9 +404,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) {