1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-06 09:15:37 -05:00

dns cache command

This commit is contained in:
v2ray
2015-12-25 01:07:42 +01:00
parent 367d17b44c
commit 8d6fdd014a
3 changed files with 113 additions and 0 deletions

View File

@@ -24,6 +24,18 @@ func (subject *AddressSubject) DisplayString() string {
return subject.Subject.DisplayString(subject.value.String())
}
func (subject *AddressSubject) Equals(another v2net.Address) {
if subject.value.IsIPv4() && another.IsIPv4() {
IP(subject.value.IP()).Equals(another.IP())
} else if subject.value.IsIPv6() && another.IsIPv6() {
IP(subject.value.IP()).Equals(another.IP())
} else if subject.value.IsDomain() && another.IsDomain() {
assert.StringLiteral(subject.value.Domain()).Equals(another.Domain())
} else {
subject.Fail(subject.DisplayString(), "equals to", another)
}
}
func (subject *AddressSubject) IsIPv4() {
if !subject.value.IsIPv4() {
subject.Fail(subject.DisplayString(), "is", serial.StringLiteral("an IPv4 address"))