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:
yuhan6665 2022-02-04 21:59:50 -05:00 committed by GitHub
parent 42284a757c
commit 41ce6ccf9f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 47 additions and 24 deletions

View file

@ -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())

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 {

View file

@ -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

View file

@ -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