mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-01-04 08:15:21 -05:00
clean imports
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/net"
|
||||
)
|
||||
|
||||
func (v *Assert) Address(value v2net.Address) *AddressSubject {
|
||||
func (v *Assert) Address(value net.Address) *AddressSubject {
|
||||
return &AddressSubject{
|
||||
Subject: Subject{
|
||||
disp: value.String(),
|
||||
@@ -16,16 +16,16 @@ func (v *Assert) Address(value v2net.Address) *AddressSubject {
|
||||
|
||||
type AddressSubject struct {
|
||||
Subject
|
||||
value v2net.Address
|
||||
value net.Address
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) NotEquals(another v2net.Address) {
|
||||
func (subject *AddressSubject) NotEquals(another net.Address) {
|
||||
if subject.value == another {
|
||||
subject.Fail("not equals to", another.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) Equals(another v2net.Address) {
|
||||
func (subject *AddressSubject) Equals(another net.Address) {
|
||||
if subject.value != another {
|
||||
subject.Fail("equals to", another.String())
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/net"
|
||||
)
|
||||
|
||||
func (v *Assert) Destination(value v2net.Destination) *DestinationSubject {
|
||||
func (v *Assert) Destination(value net.Destination) *DestinationSubject {
|
||||
return &DestinationSubject{
|
||||
Subject: Subject{
|
||||
disp: value.String(),
|
||||
@@ -16,29 +16,29 @@ func (v *Assert) Destination(value v2net.Destination) *DestinationSubject {
|
||||
|
||||
type DestinationSubject struct {
|
||||
Subject
|
||||
value v2net.Destination
|
||||
value net.Destination
|
||||
}
|
||||
|
||||
func (v *DestinationSubject) IsTCP() {
|
||||
if v.value.Network != v2net.Network_TCP {
|
||||
if v.value.Network != net.Network_TCP {
|
||||
v.Fail("is", "a TCP destination")
|
||||
}
|
||||
}
|
||||
|
||||
func (v *DestinationSubject) IsNotTCP() {
|
||||
if v.value.Network == v2net.Network_TCP {
|
||||
if v.value.Network == net.Network_TCP {
|
||||
v.Fail("is not", "a TCP destination")
|
||||
}
|
||||
}
|
||||
|
||||
func (v *DestinationSubject) IsUDP() {
|
||||
if v.value.Network != v2net.Network_UDP {
|
||||
if v.value.Network != net.Network_UDP {
|
||||
v.Fail("is", "a UDP destination")
|
||||
}
|
||||
}
|
||||
|
||||
func (v *DestinationSubject) IsNotUDP() {
|
||||
if v.value.Network == v2net.Network_UDP {
|
||||
if v.value.Network == net.Network_UDP {
|
||||
v.Fail("is not", "a UDP destination")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/net"
|
||||
)
|
||||
|
||||
func (v *Assert) Port(value v2net.Port) *PortSubject {
|
||||
func (v *Assert) Port(value net.Port) *PortSubject {
|
||||
return &PortSubject{
|
||||
Subject: Subject{
|
||||
a: v,
|
||||
@@ -16,22 +16,22 @@ func (v *Assert) Port(value v2net.Port) *PortSubject {
|
||||
|
||||
type PortSubject struct {
|
||||
Subject
|
||||
value v2net.Port
|
||||
value net.Port
|
||||
}
|
||||
|
||||
func (subject *PortSubject) Equals(expectation v2net.Port) {
|
||||
func (subject *PortSubject) Equals(expectation net.Port) {
|
||||
if subject.value.Value() != expectation.Value() {
|
||||
subject.Fail("is equal to", expectation.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *PortSubject) GreaterThan(expectation v2net.Port) {
|
||||
func (subject *PortSubject) GreaterThan(expectation net.Port) {
|
||||
if subject.value.Value() <= expectation.Value() {
|
||||
subject.Fail("is greater than", expectation.String())
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *PortSubject) LessThan(expectation v2net.Port) {
|
||||
func (subject *PortSubject) LessThan(expectation net.Port) {
|
||||
if subject.value.Value() >= expectation.Value() {
|
||||
subject.Fail("is less than", expectation.String())
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package scenarios
|
||||
|
||||
import (
|
||||
"net"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"net"
|
||||
|
||||
"github.com/golang/protobuf/proto"
|
||||
"v2ray.com/core"
|
||||
v2net "v2ray.com/core/common/net"
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"net/url"
|
||||
"testing"
|
||||
|
||||
v2net "v2ray.com/core/common/net"
|
||||
"v2ray.com/core/common/net"
|
||||
"v2ray.com/core/testing/assert"
|
||||
v2http "v2ray.com/core/testing/servers/http"
|
||||
)
|
||||
@@ -15,7 +15,7 @@ func TestHttpProxy(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
httpServer := &v2http.Server{
|
||||
Port: v2net.Port(50042),
|
||||
Port: net.Port(50042),
|
||||
PathHandler: make(map[string]http.HandlerFunc),
|
||||
}
|
||||
_, err := httpServer.Start()
|
||||
@@ -49,7 +49,7 @@ func TestBlockHTTP(t *testing.T) {
|
||||
assert := assert.On(t)
|
||||
|
||||
httpServer := &v2http.Server{
|
||||
Port: v2net.Port(50042),
|
||||
Port: net.Port(50042),
|
||||
PathHandler: make(map[string]http.HandlerFunc),
|
||||
}
|
||||
_, err := httpServer.Start()
|
||||
|
||||
Reference in New Issue
Block a user