Skip to content

Commit

Permalink
chore: enable quic sniffing
Browse files Browse the repository at this point in the history
  • Loading branch information
arm64v8a committed Aug 20, 2022
1 parent 113d64f commit 4593dce
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ fun buildV2RayConfig(
enabled = true
destOverride = when {
useFakeDns && !trafficSniffing -> listOf("fakedns")
useFakeDns -> listOf("fakedns", "http", "tls")
else -> listOf("http", "tls")
useFakeDns -> listOf("fakedns", "http", "tls", "quic")
else -> listOf("http", "tls", "quic")
}
metadataOnly = useFakeDns && !trafficSniffing
routeOnly = true
Expand Down Expand Up @@ -261,8 +261,8 @@ fun buildV2RayConfig(
enabled = true
destOverride = when {
useFakeDns && !trafficSniffing -> listOf("fakedns")
useFakeDns -> listOf("fakedns", "http", "tls")
else -> listOf("http", "tls")
useFakeDns -> listOf("fakedns", "http", "tls", "quic")
else -> listOf("http", "tls", "quic")
}
metadataOnly = useFakeDns && !trafficSniffing
routeOnly = true
Expand Down
27 changes: 18 additions & 9 deletions libcore/tun.go
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,24 @@ func (t *Tun2ray) NewPacket(source v2rayNet.Destination, destination v2rayNet.De

ctx := session.ContextWithInbound(context.Background(), inbound)

if !isDns && t.fakedns {
ctx = session.ContextWithContent(ctx, &session.Content{
SniffingRequest: session.SniffingRequest{
Enabled: true,
MetadataOnly: t.fakedns && !t.sniffing,
OverrideDestinationForProtocol: []string{"fakedns"},
RouteOnly: true,
},
})
if !isDns {
override := []string{}
if t.fakedns {
override = append(override, "fakedns")
}
if t.sniffing {
override = append(override, "quic")
}
if len(override) != 0 {
ctx = session.ContextWithContent(ctx, &session.Content{
SniffingRequest: session.SniffingRequest{
Enabled: true,
MetadataOnly: t.fakedns && !t.sniffing,
OverrideDestinationForProtocol: override,
RouteOnly: true,
},
})
}
}

workerN := 1
Expand Down

0 comments on commit 4593dce

Please sign in to comment.