mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Make reverse proxy compatible with v2fly (#924)
* Make reverse proxy compatible with v2fly * Fix gitignore * Regenerate proto files - fix v2ray name in loopback * Fix fly.org in unit tests
This commit is contained in:
parent
42284a757c
commit
41ce6ccf9f
12 changed files with 47 additions and 24 deletions
|
@ -147,31 +147,31 @@ func TestFakeDNSMulti(t *testing.T) {
|
|||
})
|
||||
|
||||
t.Run("allocateTwoAddressForTwoPool", func(t *testing.T) {
|
||||
address := fakeMulti.GetFakeIPForDomain("fakednstest.v2fly.org")
|
||||
address := fakeMulti.GetFakeIPForDomain("fakednstest.example.com")
|
||||
assert.Len(t, address, 2, "should be 2 address one for each pool")
|
||||
t.Run("eachOfThemShouldResolve:0", func(t *testing.T) {
|
||||
domain := fakeMulti.GetDomainFromFakeDNS(address[0])
|
||||
assert.Equal(t, "fakednstest.v2fly.org", domain)
|
||||
assert.Equal(t, "fakednstest.example.com", domain)
|
||||
})
|
||||
t.Run("eachOfThemShouldResolve:1", func(t *testing.T) {
|
||||
domain := fakeMulti.GetDomainFromFakeDNS(address[1])
|
||||
assert.Equal(t, "fakednstest.v2fly.org", domain)
|
||||
assert.Equal(t, "fakednstest.example.com", domain)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("understandIPTypeSelector", func(t *testing.T) {
|
||||
t.Run("ipv4", func(t *testing.T) {
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv4.v2fly.org", true, false)
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv4.example.com", true, false)
|
||||
assert.Len(t, address, 1, "should be 1 address")
|
||||
assert.True(t, address[0].Family().IsIPv4())
|
||||
})
|
||||
t.Run("ipv6", func(t *testing.T) {
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv6.v2fly.org", false, true)
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv6.example.com", false, true)
|
||||
assert.Len(t, address, 1, "should be 1 address")
|
||||
assert.True(t, address[0].Family().IsIPv6())
|
||||
})
|
||||
t.Run("ipv46", func(t *testing.T) {
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv46.v2fly.org", true, true)
|
||||
address := fakeMulti.GetFakeIPForDomain3("fakednstestipv46.example.com", true, true)
|
||||
assert.Len(t, address, 2, "should be 2 address")
|
||||
assert.True(t, address[0].Family().IsIPv4())
|
||||
assert.True(t, address[1].Family().IsIPv6())
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.18.0
|
||||
// source: app/log/command/config.proto
|
||||
|
||||
package command
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.18.0
|
||||
// source: app/observatory/command/command.proto
|
||||
|
||||
package command
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.18.0
|
||||
// source: app/proxyman/command/command.proto
|
||||
|
||||
package command
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.27.1
|
||||
// protoc v3.19.1
|
||||
// protoc v3.18.0
|
||||
// source: app/proxyman/config.proto
|
||||
|
||||
package proxyman
|
||||
|
|
|
@ -14,7 +14,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
internalDomain = "reverse.internal.example.com"
|
||||
internalDomain = "reverse.internal.v2fly.org" // make reverse proxy compatible with v2fly
|
||||
)
|
||||
|
||||
func isDomain(dest net.Destination, domain string) bool {
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.18.0
|
||||
// source: app/router/command/command.proto
|
||||
|
||||
package command
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.18.0
|
||||
// source: app/stats/command/command.proto
|
||||
|
||||
package command
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue