From 4e32c31e1f9f3a0bc6f60a3d426a8cf71ea209e7 Mon Sep 17 00:00:00 2001 From: Matt Tracy Date: Thu, 6 Aug 2015 16:25:35 -0400 Subject: [PATCH] UnresolvedAddress.string_field -> address_field The field name of this structure was changed by #1976, but it has since been decided that "address" is a more accurate name than "string". --- rpc/client.go | 2 +- server/node_test.go | 4 +- server/status_test.go | 2 +- .../cockroach/util/unresolved_addr.pb.cc | 136 +++++++++--------- .../cockroach/util/unresolved_addr.pb.h | 98 ++++++------- util/unresolved_addr.go | 10 +- util/unresolved_addr.pb.go | 16 +-- util/unresolved_addr.proto | 2 +- 8 files changed, 135 insertions(+), 135 deletions(-) diff --git a/rpc/client.go b/rpc/client.go index 0eb469eacb09..bbdf6d9c1cd7 100644 --- a/rpc/client.go +++ b/rpc/client.go @@ -157,7 +157,7 @@ func (c *Client) internalConn() *internalConn { // connect attempts a single connection attempt. On success, updates `c.conn`. func (c *Client) connect() error { - conn, err := TLSDialHTTP(c.addr.NetworkField, c.addr.StringField, c.tlsConfig) + conn, err := TLSDialHTTP(c.addr.NetworkField, c.addr.AddressField, c.tlsConfig) if err != nil { return err } diff --git a/server/node_test.go b/server/node_test.go index 05b6bf544a8f..f6c50a6e19bc 100644 --- a/server/node_test.go +++ b/server/node_test.go @@ -216,12 +216,12 @@ func TestNodeJoin(t *testing.T) { if err := util.IsTrueWithin(func() bool { if val, err := node1.ctx.Gossip.GetInfo(node2Key); err != nil { return false - } else if addr2 := val.(*proto.NodeDescriptor).Address.StringField; addr2 != server2.Addr().String() { + } else if addr2 := val.(*proto.NodeDescriptor).Address.AddressField; addr2 != server2.Addr().String() { t.Errorf("addr2 gossip %s doesn't match addr2 address %s", addr2, server2.Addr().String()) } if val, err := node2.ctx.Gossip.GetInfo(node1Key); err != nil { return false - } else if addr1 := val.(*proto.NodeDescriptor).Address.StringField; addr1 != server1.Addr().String() { + } else if addr1 := val.(*proto.NodeDescriptor).Address.AddressField; addr1 != server1.Addr().String() { t.Errorf("addr1 gossip %s doesn't match addr1 address %s", addr1, server1.Addr().String()) } return true diff --git a/server/status_test.go b/server/status_test.go index ca4e7a11565b..620bcc274041 100644 --- a/server/status_test.go +++ b/server/status_test.go @@ -92,7 +92,7 @@ func TestStatusJson(t *testing.T) { "nodeID": 1, "address": { "network": "%s", - "string": "%s" + "address": "%s" }, "buildInfo": { "goVersion": "%s", diff --git a/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.cc b/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.cc index 999c3a6d9ff0..3eb53ec6d4a6 100644 --- a/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.cc +++ b/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.cc @@ -37,7 +37,7 @@ void protobuf_AssignDesc_cockroach_2futil_2funresolved_5faddr_2eproto() { UnresolvedAddr_descriptor_ = file->message_type(0); static const int UnresolvedAddr_offsets_[2] = { GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UnresolvedAddr, network_field_), - GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UnresolvedAddr, string_field_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UnresolvedAddr, address_field_), }; UnresolvedAddr_reflection_ = ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( @@ -82,11 +82,11 @@ void protobuf_AddDesc_cockroach_2futil_2funresolved_5faddr_2eproto() { ::gogoproto::protobuf_AddDesc_gogoproto_2fgogo_2eproto(); ::google::protobuf::DescriptorPool::InternalAddGeneratedFile( "\n$cockroach/util/unresolved_addr.proto\022\016" - "cockroach.util\032\024gogoproto/gogo.proto\"d\n\016" + "cockroach.util\032\024gogoproto/gogo.proto\"f\n\016" "UnresolvedAddr\022&\n\rnetwork_field\030\001 \001(\tB\017\310" - "\336\037\000\352\336\037\007network\022$\n\014string_field\030\002 \001(\tB\016\310\336" - "\037\000\352\336\037\006string:\004\230\240\037\000B\026Z\004util\340\342\036\001\310\342\036\001\320\342\036\001\220\343" - "\036\000", 202); + "\336\037\000\352\336\037\007network\022&\n\raddress_field\030\002 \001(\tB\017\310" + "\336\037\000\352\336\037\007address:\004\230\240\037\000B\026Z\004util\340\342\036\001\310\342\036\001\320\342\036\001" + "\220\343\036\000", 204); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "cockroach/util/unresolved_addr.proto", &protobuf_RegisterTypes); UnresolvedAddr::default_instance_ = new UnresolvedAddr(); @@ -115,7 +115,7 @@ static void MergeFromFail(int line) { #ifndef _MSC_VER const int UnresolvedAddr::kNetworkFieldFieldNumber; -const int UnresolvedAddr::kStringFieldFieldNumber; +const int UnresolvedAddr::kAddressFieldFieldNumber; #endif // !_MSC_VER UnresolvedAddr::UnresolvedAddr() @@ -139,7 +139,7 @@ void UnresolvedAddr::SharedCtor() { ::google::protobuf::internal::GetEmptyString(); _cached_size_ = 0; network_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - string_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + address_field_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); ::memset(_has_bits_, 0, sizeof(_has_bits_)); } @@ -150,7 +150,7 @@ UnresolvedAddr::~UnresolvedAddr() { void UnresolvedAddr::SharedDtor() { network_field_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - string_field_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + address_field_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); if (this != default_instance_) { } } @@ -185,8 +185,8 @@ void UnresolvedAddr::Clear() { if (has_network_field()) { network_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - if (has_string_field()) { - string_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (has_address_field()) { + address_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } } ::memset(_has_bits_, 0, sizeof(_has_bits_)); @@ -217,20 +217,20 @@ bool UnresolvedAddr::MergePartialFromCodedStream( } else { goto handle_unusual; } - if (input->ExpectTag(18)) goto parse_string_field; + if (input->ExpectTag(18)) goto parse_address_field; break; } - // optional string string_field = 2; + // optional string address_field = 2; case 2: { if (tag == 18) { - parse_string_field: + parse_address_field: DO_(::google::protobuf::internal::WireFormatLite::ReadString( - input, this->mutable_string_field())); + input, this->mutable_address_field())); ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->string_field().data(), this->string_field().length(), + this->address_field().data(), this->address_field().length(), ::google::protobuf::internal::WireFormat::PARSE, - "cockroach.util.UnresolvedAddr.string_field"); + "cockroach.util.UnresolvedAddr.address_field"); } else { goto handle_unusual; } @@ -273,14 +273,14 @@ void UnresolvedAddr::SerializeWithCachedSizes( 1, this->network_field(), output); } - // optional string string_field = 2; - if (has_string_field()) { + // optional string address_field = 2; + if (has_address_field()) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->string_field().data(), this->string_field().length(), + this->address_field().data(), this->address_field().length(), ::google::protobuf::internal::WireFormat::SERIALIZE, - "cockroach.util.UnresolvedAddr.string_field"); + "cockroach.util.UnresolvedAddr.address_field"); ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( - 2, this->string_field(), output); + 2, this->address_field(), output); } if (_internal_metadata_.have_unknown_fields()) { @@ -304,15 +304,15 @@ ::google::protobuf::uint8* UnresolvedAddr::SerializeWithCachedSizesToArray( 1, this->network_field(), target); } - // optional string string_field = 2; - if (has_string_field()) { + // optional string address_field = 2; + if (has_address_field()) { ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( - this->string_field().data(), this->string_field().length(), + this->address_field().data(), this->address_field().length(), ::google::protobuf::internal::WireFormat::SERIALIZE, - "cockroach.util.UnresolvedAddr.string_field"); + "cockroach.util.UnresolvedAddr.address_field"); target = ::google::protobuf::internal::WireFormatLite::WriteStringToArray( - 2, this->string_field(), target); + 2, this->address_field(), target); } if (_internal_metadata_.have_unknown_fields()) { @@ -334,11 +334,11 @@ int UnresolvedAddr::ByteSize() const { this->network_field()); } - // optional string string_field = 2; - if (has_string_field()) { + // optional string address_field = 2; + if (has_address_field()) { total_size += 1 + ::google::protobuf::internal::WireFormatLite::StringSize( - this->string_field()); + this->address_field()); } } @@ -372,9 +372,9 @@ void UnresolvedAddr::MergeFrom(const UnresolvedAddr& from) { set_has_network_field(); network_field_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.network_field_); } - if (from.has_string_field()) { - set_has_string_field(); - string_field_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.string_field_); + if (from.has_address_field()) { + set_has_address_field(); + address_field_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.address_field_); } } if (from._internal_metadata_.have_unknown_fields()) { @@ -405,7 +405,7 @@ void UnresolvedAddr::Swap(UnresolvedAddr* other) { } void UnresolvedAddr::InternalSwap(UnresolvedAddr* other) { network_field_.Swap(&other->network_field_); - string_field_.Swap(&other->string_field_); + address_field_.Swap(&other->address_field_); std::swap(_has_bits_[0], other->_has_bits_[0]); _internal_metadata_.Swap(&other->_internal_metadata_); std::swap(_cached_size_, other->_cached_size_); @@ -475,57 +475,57 @@ void UnresolvedAddr::clear_network_field() { // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.network_field) } -// optional string string_field = 2; -bool UnresolvedAddr::has_string_field() const { +// optional string address_field = 2; +bool UnresolvedAddr::has_address_field() const { return (_has_bits_[0] & 0x00000002u) != 0; } -void UnresolvedAddr::set_has_string_field() { +void UnresolvedAddr::set_has_address_field() { _has_bits_[0] |= 0x00000002u; } -void UnresolvedAddr::clear_has_string_field() { +void UnresolvedAddr::clear_has_address_field() { _has_bits_[0] &= ~0x00000002u; } -void UnresolvedAddr::clear_string_field() { - string_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_string_field(); +void UnresolvedAddr::clear_address_field() { + address_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_address_field(); } - const ::std::string& UnresolvedAddr::string_field() const { - // @@protoc_insertion_point(field_get:cockroach.util.UnresolvedAddr.string_field) - return string_field_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + const ::std::string& UnresolvedAddr::address_field() const { + // @@protoc_insertion_point(field_get:cockroach.util.UnresolvedAddr.address_field) + return address_field_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void UnresolvedAddr::set_string_field(const ::std::string& value) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:cockroach.util.UnresolvedAddr.string_field) + void UnresolvedAddr::set_address_field(const ::std::string& value) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:cockroach.util.UnresolvedAddr.address_field) } - void UnresolvedAddr::set_string_field(const char* value) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:cockroach.util.UnresolvedAddr.string_field) + void UnresolvedAddr::set_address_field(const char* value) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:cockroach.util.UnresolvedAddr.address_field) } - void UnresolvedAddr::set_string_field(const char* value, size_t size) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + void UnresolvedAddr::set_address_field(const char* value, size_t size) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:cockroach.util.UnresolvedAddr.string_field) + // @@protoc_insertion_point(field_set_pointer:cockroach.util.UnresolvedAddr.address_field) } - ::std::string* UnresolvedAddr::mutable_string_field() { - set_has_string_field(); - // @@protoc_insertion_point(field_mutable:cockroach.util.UnresolvedAddr.string_field) - return string_field_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* UnresolvedAddr::mutable_address_field() { + set_has_address_field(); + // @@protoc_insertion_point(field_mutable:cockroach.util.UnresolvedAddr.address_field) + return address_field_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - ::std::string* UnresolvedAddr::release_string_field() { - clear_has_string_field(); - return string_field_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + ::std::string* UnresolvedAddr::release_address_field() { + clear_has_address_field(); + return address_field_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } - void UnresolvedAddr::set_allocated_string_field(::std::string* string_field) { - if (string_field != NULL) { - set_has_string_field(); + void UnresolvedAddr::set_allocated_address_field(::std::string* address_field) { + if (address_field != NULL) { + set_has_address_field(); } else { - clear_has_string_field(); + clear_has_address_field(); } - string_field_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_field); - // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.string_field) + address_field_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), address_field); + // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.address_field) } #endif // PROTOBUF_INLINE_NOT_IN_HEADERS diff --git a/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.h b/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.h index b18bcb2bd72b..acffd99d2777 100644 --- a/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.h +++ b/storage/engine/rocksdb/cockroach/util/unresolved_addr.pb.h @@ -118,30 +118,30 @@ class UnresolvedAddr : public ::google::protobuf::Message { ::std::string* release_network_field(); void set_allocated_network_field(::std::string* network_field); - // optional string string_field = 2; - bool has_string_field() const; - void clear_string_field(); - static const int kStringFieldFieldNumber = 2; - const ::std::string& string_field() const; - void set_string_field(const ::std::string& value); - void set_string_field(const char* value); - void set_string_field(const char* value, size_t size); - ::std::string* mutable_string_field(); - ::std::string* release_string_field(); - void set_allocated_string_field(::std::string* string_field); + // optional string address_field = 2; + bool has_address_field() const; + void clear_address_field(); + static const int kAddressFieldFieldNumber = 2; + const ::std::string& address_field() const; + void set_address_field(const ::std::string& value); + void set_address_field(const char* value); + void set_address_field(const char* value, size_t size); + ::std::string* mutable_address_field(); + ::std::string* release_address_field(); + void set_allocated_address_field(::std::string* address_field); // @@protoc_insertion_point(class_scope:cockroach.util.UnresolvedAddr) private: inline void set_has_network_field(); inline void clear_has_network_field(); - inline void set_has_string_field(); - inline void clear_has_string_field(); + inline void set_has_address_field(); + inline void clear_has_address_field(); ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; ::google::protobuf::uint32 _has_bits_[1]; mutable int _cached_size_; ::google::protobuf::internal::ArenaStringPtr network_field_; - ::google::protobuf::internal::ArenaStringPtr string_field_; + ::google::protobuf::internal::ArenaStringPtr address_field_; friend void protobuf_AddDesc_cockroach_2futil_2funresolved_5faddr_2eproto(); friend void protobuf_AssignDesc_cockroach_2futil_2funresolved_5faddr_2eproto(); friend void protobuf_ShutdownFile_cockroach_2futil_2funresolved_5faddr_2eproto(); @@ -210,57 +210,57 @@ inline void UnresolvedAddr::set_allocated_network_field(::std::string* network_f // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.network_field) } -// optional string string_field = 2; -inline bool UnresolvedAddr::has_string_field() const { +// optional string address_field = 2; +inline bool UnresolvedAddr::has_address_field() const { return (_has_bits_[0] & 0x00000002u) != 0; } -inline void UnresolvedAddr::set_has_string_field() { +inline void UnresolvedAddr::set_has_address_field() { _has_bits_[0] |= 0x00000002u; } -inline void UnresolvedAddr::clear_has_string_field() { +inline void UnresolvedAddr::clear_has_address_field() { _has_bits_[0] &= ~0x00000002u; } -inline void UnresolvedAddr::clear_string_field() { - string_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); - clear_has_string_field(); +inline void UnresolvedAddr::clear_address_field() { + address_field_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_address_field(); } -inline const ::std::string& UnresolvedAddr::string_field() const { - // @@protoc_insertion_point(field_get:cockroach.util.UnresolvedAddr.string_field) - return string_field_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline const ::std::string& UnresolvedAddr::address_field() const { + // @@protoc_insertion_point(field_get:cockroach.util.UnresolvedAddr.address_field) + return address_field_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void UnresolvedAddr::set_string_field(const ::std::string& value) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); - // @@protoc_insertion_point(field_set:cockroach.util.UnresolvedAddr.string_field) +inline void UnresolvedAddr::set_address_field(const ::std::string& value) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:cockroach.util.UnresolvedAddr.address_field) } -inline void UnresolvedAddr::set_string_field(const char* value) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); - // @@protoc_insertion_point(field_set_char:cockroach.util.UnresolvedAddr.string_field) +inline void UnresolvedAddr::set_address_field(const char* value) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:cockroach.util.UnresolvedAddr.address_field) } -inline void UnresolvedAddr::set_string_field(const char* value, size_t size) { - set_has_string_field(); - string_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), +inline void UnresolvedAddr::set_address_field(const char* value, size_t size) { + set_has_address_field(); + address_field_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(reinterpret_cast(value), size)); - // @@protoc_insertion_point(field_set_pointer:cockroach.util.UnresolvedAddr.string_field) + // @@protoc_insertion_point(field_set_pointer:cockroach.util.UnresolvedAddr.address_field) } -inline ::std::string* UnresolvedAddr::mutable_string_field() { - set_has_string_field(); - // @@protoc_insertion_point(field_mutable:cockroach.util.UnresolvedAddr.string_field) - return string_field_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* UnresolvedAddr::mutable_address_field() { + set_has_address_field(); + // @@protoc_insertion_point(field_mutable:cockroach.util.UnresolvedAddr.address_field) + return address_field_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline ::std::string* UnresolvedAddr::release_string_field() { - clear_has_string_field(); - return string_field_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +inline ::std::string* UnresolvedAddr::release_address_field() { + clear_has_address_field(); + return address_field_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); } -inline void UnresolvedAddr::set_allocated_string_field(::std::string* string_field) { - if (string_field != NULL) { - set_has_string_field(); +inline void UnresolvedAddr::set_allocated_address_field(::std::string* address_field) { + if (address_field != NULL) { + set_has_address_field(); } else { - clear_has_string_field(); + clear_has_address_field(); } - string_field_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), string_field); - // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.string_field) + address_field_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), address_field); + // @@protoc_insertion_point(field_set_allocated:cockroach.util.UnresolvedAddr.address_field) } #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS diff --git a/util/unresolved_addr.go b/util/unresolved_addr.go index f24bac7fea19..77426d472f7b 100644 --- a/util/unresolved_addr.go +++ b/util/unresolved_addr.go @@ -27,7 +27,7 @@ import ( func MakeUnresolvedAddr(network string, str string) UnresolvedAddr { return UnresolvedAddr{ NetworkField: network, - StringField: str, + AddressField: str, } } @@ -38,18 +38,18 @@ func (a UnresolvedAddr) Network() string { // String returns the address's string form. func (a UnresolvedAddr) String() string { - return a.StringField + return a.AddressField } // Resolve attempts to resolve a into a net.Addr. func (a UnresolvedAddr) Resolve() (net.Addr, error) { switch a.NetworkField { case "tcp", "tcp4", "tcp6": - return net.ResolveTCPAddr(a.NetworkField, a.StringField) + return net.ResolveTCPAddr(a.NetworkField, a.AddressField) case "udp", "udp4", "udp6": - return net.ResolveUDPAddr(a.NetworkField, a.StringField) + return net.ResolveUDPAddr(a.NetworkField, a.AddressField) case "unix", "unixgram", "unixpacket": - return net.ResolveUnixAddr(a.NetworkField, a.StringField) + return net.ResolveUnixAddr(a.NetworkField, a.AddressField) } return nil, fmt.Errorf("network %s not supported", a.NetworkField) } diff --git a/util/unresolved_addr.pb.go b/util/unresolved_addr.pb.go index a6e44c7b046a..bfaf4b222144 100644 --- a/util/unresolved_addr.pb.go +++ b/util/unresolved_addr.pb.go @@ -28,7 +28,7 @@ var _ = math.Inf // / UnresolvedAddr is an unresolved version of net.Addr. type UnresolvedAddr struct { NetworkField string `protobuf:"bytes,1,opt,name=network_field" json:"network"` - StringField string `protobuf:"bytes,2,opt,name=string_field" json:"string"` + AddressField string `protobuf:"bytes,2,opt,name=address_field" json:"address"` } func (m *UnresolvedAddr) Reset() { *m = UnresolvedAddr{} } @@ -41,9 +41,9 @@ func (m *UnresolvedAddr) GetNetworkField() string { return "" } -func (m *UnresolvedAddr) GetStringField() string { +func (m *UnresolvedAddr) GetAddressField() string { if m != nil { - return m.StringField + return m.AddressField } return "" } @@ -91,7 +91,7 @@ func (m *UnresolvedAddr) Unmarshal(data []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StringField", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field AddressField", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -109,7 +109,7 @@ func (m *UnresolvedAddr) Unmarshal(data []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.StringField = string(data[iNdEx:postIndex]) + m.AddressField = string(data[iNdEx:postIndex]) iNdEx = postIndex default: var sizeOfWire int @@ -234,7 +234,7 @@ func (m *UnresolvedAddr) Size() (n int) { _ = l l = len(m.NetworkField) n += 1 + l + sovUnresolvedAddr(uint64(l)) - l = len(m.StringField) + l = len(m.AddressField) n += 1 + l + sovUnresolvedAddr(uint64(l)) return n } @@ -273,8 +273,8 @@ func (m *UnresolvedAddr) MarshalTo(data []byte) (n int, err error) { i += copy(data[i:], m.NetworkField) data[i] = 0x12 i++ - i = encodeVarintUnresolvedAddr(data, i, uint64(len(m.StringField))) - i += copy(data[i:], m.StringField) + i = encodeVarintUnresolvedAddr(data, i, uint64(len(m.AddressField))) + i += copy(data[i:], m.AddressField) return i, nil } diff --git a/util/unresolved_addr.proto b/util/unresolved_addr.proto index b1e189e1837b..d829749a797a 100644 --- a/util/unresolved_addr.proto +++ b/util/unresolved_addr.proto @@ -30,5 +30,5 @@ option (gogoproto.goproto_unrecognized_all) = false; message UnresolvedAddr { option (gogoproto.goproto_stringer) = false; optional string network_field = 1 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "network"]; - optional string string_field = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "string"]; + optional string address_field = 2 [(gogoproto.nullable) = false, (gogoproto.jsontag) = "address"]; }