mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-24 23:19:44 +00:00
cleanup http proxy package
This commit is contained in:
1 parent
b47c1ca609
commit
9b07ffd68f
5 files changed
+31
-75
No files matched your search
@@ -1,31 +1,3 @@
|
||||
// +build json
|
||||
|
||||
package http_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
v2net "github.com/v2ray/v2ray-core/common/net"
|
||||
. "github.com/v2ray/v2ray-core/proxy/http"
|
||||
"github.com/v2ray/v2ray-core/testing/assert"
|
||||
)
|
||||
|
||||
func TestOwnHosts(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
rawJson := `{
|
||||
"ownHosts": [
|
||||
"127.0.0.1",
|
||||
"google.com"
|
||||
]
|
||||
}`
|
||||
|
||||
config := new(Config)
|
||||
err := json.Unmarshal([]byte(rawJson), config)
|
||||
assert.Error(err).IsNil()
|
||||
assert.Bool(config.IsOwnHost(v2net.IPAddress([]byte{127, 0, 0, 1}))).IsTrue()
|
||||
assert.Bool(config.IsOwnHost(v2net.DomainAddress("google.com"))).IsTrue()
|
||||
assert.Bool(config.IsOwnHost(v2net.DomainAddress("local.v2ray.com"))).IsTrue()
|
||||
assert.Bool(config.IsOwnHost(v2net.DomainAddress("v2ray.com"))).IsFalse()
|
||||
}
|
||||
Reference in new issue
Block a user