refactor protos

This commit is contained in:
Darien Raymond committed 2016-10-12 18:43:55 +02:00
1 parent c1f91567ad
commit fc6a706166
44 files changed
+331 -313

No files matched your search

+3 -3
View File
@@ -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(),
}
}