mirror of
https://github.com/v2ray/v2ray-core.git
synced 2026-11-29 07:32:44 +00:00
refactor protos
This commit is contained in:
44 files changed
+331
-313
No files matched your search
@@ -6,7 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func (this *AddressPB) UnmarshalJSON(data []byte) error {
|
||||
func (this *IPOrDomain) UnmarshalJSON(data []byte) error {
|
||||
var rawStr string
|
||||
if err := json.Unmarshal(data, &rawStr); err != nil {
|
||||
return err
|
||||
@@ -14,11 +14,11 @@ func (this *AddressPB) UnmarshalJSON(data []byte) error {
|
||||
addr := ParseAddress(rawStr)
|
||||
switch addr.Family() {
|
||||
case AddressFamilyIPv4, AddressFamilyIPv6:
|
||||
this.Address = &AddressPB_Ip{
|
||||
this.Address = &IPOrDomain_Ip{
|
||||
Ip: []byte(addr.IP()),
|
||||
}
|
||||
case AddressFamilyDomain:
|
||||
this.Address = &AddressPB_Domain{
|
||||
this.Address = &IPOrDomain_Domain{
|
||||
Domain: addr.Domain(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user