mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-25 10:01:30 +00:00
Fix SOCKS5 UDP sniffing accidentially enabled
This commit is contained in:
parent
6011f4483a
commit
027af4d4ee
|
@ -770,20 +770,22 @@ func (r *Router) RoutePacketConnection(ctx context.Context, conn N.PacketConn, m
|
||||||
if metadata.Destination.Addr.IsUnspecified() {
|
if metadata.Destination.Addr.IsUnspecified() {
|
||||||
metadata.Destination = destination
|
metadata.Destination = destination
|
||||||
}
|
}
|
||||||
sniffMetadata, _ := sniff.PeekPacket(ctx, buffer.Bytes(), sniff.DomainNameQuery, sniff.QUICClientHello, sniff.STUNMessage)
|
if metadata.InboundOptions.SniffEnabled {
|
||||||
if sniffMetadata != nil {
|
sniffMetadata, _ := sniff.PeekPacket(ctx, buffer.Bytes(), sniff.DomainNameQuery, sniff.QUICClientHello, sniff.STUNMessage)
|
||||||
metadata.Protocol = sniffMetadata.Protocol
|
if sniffMetadata != nil {
|
||||||
metadata.Domain = sniffMetadata.Domain
|
metadata.Protocol = sniffMetadata.Protocol
|
||||||
if metadata.InboundOptions.SniffOverrideDestination && M.IsDomainName(metadata.Domain) {
|
metadata.Domain = sniffMetadata.Domain
|
||||||
metadata.Destination = M.Socksaddr{
|
if metadata.InboundOptions.SniffOverrideDestination && M.IsDomainName(metadata.Domain) {
|
||||||
Fqdn: metadata.Domain,
|
metadata.Destination = M.Socksaddr{
|
||||||
Port: metadata.Destination.Port,
|
Fqdn: metadata.Domain,
|
||||||
|
Port: metadata.Destination.Port,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if metadata.Domain != "" {
|
||||||
|
r.logger.DebugContext(ctx, "sniffed packet protocol: ", metadata.Protocol, ", domain: ", metadata.Domain)
|
||||||
|
} else {
|
||||||
|
r.logger.DebugContext(ctx, "sniffed packet protocol: ", metadata.Protocol)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if metadata.Domain != "" {
|
|
||||||
r.logger.DebugContext(ctx, "sniffed packet protocol: ", metadata.Protocol, ", domain: ", metadata.Domain)
|
|
||||||
} else {
|
|
||||||
r.logger.DebugContext(ctx, "sniffed packet protocol: ", metadata.Protocol)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
conn = bufio.NewCachedPacketConn(conn, buffer, destination)
|
conn = bufio.NewCachedPacketConn(conn, buffer, destination)
|
||||||
|
|
Loading…
Reference in a new issue