mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-28 16:39:08 -04:00
introduce address family in v2net
This commit is contained in:
@@ -44,37 +44,37 @@ func (subject *AddressSubject) EqualsString(another string) {
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsIPv4() {
|
||||
if !subject.value.IsIPv4() {
|
||||
if !subject.value.Family().IsIPv4() {
|
||||
subject.Fail("is", "an IPv4 address")
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsNotIPv4() {
|
||||
if subject.value.IsIPv4() {
|
||||
if subject.value.Family().IsIPv4() {
|
||||
subject.Fail("is not", "an IPv4 address")
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsIPv6() {
|
||||
if !subject.value.IsIPv6() {
|
||||
if !subject.value.Family().IsIPv6() {
|
||||
subject.Fail("is", "an IPv6 address")
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsNotIPv6() {
|
||||
if subject.value.IsIPv6() {
|
||||
if subject.value.Family().IsIPv6() {
|
||||
subject.Fail("is not", "an IPv6 address")
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsDomain() {
|
||||
if !subject.value.IsDomain() {
|
||||
if !subject.value.Family().IsDomain() {
|
||||
subject.Fail("is", "a domain address")
|
||||
}
|
||||
}
|
||||
|
||||
func (subject *AddressSubject) IsNotDomain() {
|
||||
if subject.value.IsDomain() {
|
||||
if subject.value.Family().IsDomain() {
|
||||
subject.Fail("is not", "a domain address")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user