Fix leaks and add test

This commit is contained in:
世界
2022-09-23 13:14:31 +08:00
parent 9856b73cb5
commit 407509c985
19 changed files with 167 additions and 59 deletions

View File

@@ -103,6 +103,10 @@ func (h *Trojan) NewPacketConnection(ctx context.Context, conn N.PacketConn, met
return NewPacketConnection(ctx, h, conn, metadata)
}
func (h *Trojan) Close() error {
return common.Close(h.multiplexDialer, h.transport)
}
type trojanDialer Trojan
func (h *trojanDialer) DialContext(ctx context.Context, network string, destination M.Socksaddr) (net.Conn, error) {