diff --git a/config/config.pb.go b/config/config.pb.go index 04b42396..73a9213e 100644 --- a/config/config.pb.go +++ b/config/config.pb.go @@ -15,7 +15,7 @@ package config import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import cloudprober_probes "github.com/google/cloudprober/probes" +import cloudprober_probes "github.com/google/cloudprober/probes/proto" import cloudprober_servers "github.com/google/cloudprober/servers" import cloudprober_targets "github.com/google/cloudprober/targets" import cloudprober_surfacer "github.com/google/cloudprober/surfacers" @@ -144,30 +144,30 @@ func init() { func init() { proto.RegisterFile("github.com/google/cloudprober/config/config.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 385 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xdd, 0xcb, 0xd3, 0x30, - 0x14, 0xc6, 0xa9, 0x73, 0x7e, 0x64, 0x8a, 0x12, 0x3f, 0x28, 0x43, 0xa4, 0x7a, 0x55, 0x6f, 0xda, - 0xae, 0x8a, 0xe0, 0xc0, 0x0b, 0x51, 0x19, 0x5e, 0x88, 0x92, 0xca, 0xc0, 0xab, 0x98, 0x66, 0x59, - 0x2d, 0x74, 0x4d, 0x39, 0xc9, 0x0a, 0xfe, 0xed, 0xde, 0xbc, 0x34, 0x49, 0x47, 0xbb, 0x77, 0x6c, - 0xef, 0x45, 0x39, 0xa7, 0xc9, 0xf3, 0x7b, 0x9e, 0x9e, 0x53, 0xb4, 0x28, 0x4a, 0xfd, 0x77, 0x9f, - 0x47, 0x5c, 0xee, 0xe2, 0x42, 0xca, 0xa2, 0x12, 0x31, 0xaf, 0xe4, 0x7e, 0xd3, 0x80, 0xcc, 0x05, - 0xc4, 0x5c, 0xd6, 0xdb, 0xb2, 0x70, 0x25, 0x6a, 0x40, 0x6a, 0x89, 0x67, 0x03, 0xc1, 0xfc, 0x02, - 0x6f, 0x8a, 0x1a, 0xf1, 0xf3, 0xf4, 0x3c, 0xa2, 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 0xee, 0xbf, - 0xd6, 0xed, 0x9a, 0x01, 0xa6, 0x08, 0x83, 0xe6, 0xd4, 0x6e, 0x94, 0xca, 0x46, 0x97, 0xb2, 0x56, - 0x3e, 0x0f, 0xbc, 0x70, 0x96, 0x2e, 0x46, 0x33, 0xf4, 0xbf, 0x7c, 0xb8, 0x7f, 0xa2, 0x39, 0x31, - 0xfd, 0x0f, 0x0b, 0x92, 0xc7, 0x70, 0x74, 0x82, 0x29, 0x7a, 0x5e, 0x54, 0x32, 0x67, 0x15, 0x75, - 0x06, 0x87, 0x90, 0x8d, 0x09, 0x79, 0x73, 0x32, 0x64, 0x65, 0x90, 0x5f, 0xf6, 0xad, 0x37, 0x7f, - 0x5a, 0x9c, 0x38, 0xbd, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xb2, 0x78, 0x0b, 0x59, 0x03, 0x00, - 0x00, + // 391 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x91, 0xdd, 0x8b, 0xd3, 0x40, + 0x14, 0xc5, 0x89, 0xb5, 0x7e, 0x4c, 0x15, 0x65, 0xfc, 0x20, 0x14, 0x91, 0xe8, 0x53, 0x7c, 0x49, + 0xd2, 0x28, 0x8a, 0x05, 0x1f, 0x44, 0xa5, 0xf8, 0x20, 0xca, 0x44, 0x0a, 0x3e, 0x8d, 0x93, 0xe9, + 0x34, 0x1b, 0x48, 0x33, 0xe1, 0xce, 0x34, 0xb0, 0x7f, 0xfb, 0xbe, 0x2c, 0x99, 0x99, 0x94, 0x64, + 0xb7, 0x74, 0xf7, 0x21, 0xdc, 0x9b, 0x99, 0xf3, 0x3b, 0x27, 0xf7, 0x06, 0x2d, 0x8a, 0x52, 0x9f, + 0xed, 0xf3, 0x88, 0xcb, 0x5d, 0x5c, 0x48, 0x59, 0x54, 0x22, 0xe6, 0x95, 0xdc, 0x6f, 0x1a, 0x90, + 0xb9, 0x80,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0x49, 0x7e, 0x29, 0xc1, 0x71, 0x8c, 0x9e, 0xf4, 0xa8, + 0xa8, 0x5b, 0xda, 0x32, 0xf0, 0xf3, 0xc0, 0x0b, 0x1f, 0x2e, 0xef, 0x67, 0xff, 0xb2, 0xf5, 0x57, + 0x92, 0x91, 0xc7, 0xee, 0xfe, 0x47, 0xdd, 0xae, 0x19, 0x60, 0x8a, 0x30, 0x68, 0x4e, 0xed, 0x46, + 0xa9, 0x6c, 0x74, 0x29, 0x6b, 0xe5, 0xf3, 0xc0, 0x0b, 0x67, 0xe9, 0x62, 0x34, 0x43, 0xff, 0xcb, + 0x87, 0xfb, 0x27, 0x9a, 0x13, 0xd3, 0xff, 0xb6, 0x20, 0x79, 0x0a, 0x57, 0x4e, 0x30, 0x45, 0x2f, + 0x8b, 0x4a, 0xe6, 0xac, 0xa2, 0xce, 0xe0, 0x10, 0xb2, 0x31, 0x21, 0xef, 0x8e, 0x86, 0xac, 0x0c, + 0xf2, 0xd7, 0xbe, 0xf5, 0xe6, 0xcf, 0x8b, 0x23, 0xa7, 0x97, 0x01, 0x00, 0x00, 0xff, 0xff, 0xeb, + 0x95, 0xbc, 0x2b, 0x5f, 0x03, 0x00, 0x00, } diff --git a/config/config.proto b/config/config.proto index af417b32..99929574 100644 --- a/config/config.proto +++ b/config/config.proto @@ -1,6 +1,6 @@ syntax = "proto2"; -import "github.com/google/cloudprober/probes/config.proto"; +import "github.com/google/cloudprober/probes/proto/config.proto"; import "github.com/google/cloudprober/servers/config.proto"; import "github.com/google/cloudprober/targets/targets.proto"; import "github.com/google/cloudprober/surfacers/config.proto"; diff --git a/message/message.go b/message/message.go index 546e6234..a0faef6a 100644 --- a/message/message.go +++ b/message/message.go @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2017-2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import ( "time" "github.com/golang/protobuf/proto" + msgpb "github.com/google/cloudprober/message/proto" ) // FlowState maintains the state of flow on both the src and dst sides. @@ -71,7 +72,7 @@ const ( lostThreshold = 3600 * 24 ) -var constants Constants +var constants msgpb.Constants // Uint64ToNetworkBytes converts a 64bit unsigned integer to an 8-byte slice. // in network byte order. @@ -106,13 +107,13 @@ func NetworkBytesToUint64(bytes []byte) uint64 { // Message is a wrapper struct for the message protobuf that provides // functions to access the most commonly accessed fields. type Message struct { - m *Msg + m *msgpb.Msg } // NewMessage parses a byte array into a message. func NewMessage(msgBytes []byte) (*Message, error) { m := &Message{ - m: &Msg{}, + m: &msgpb.Msg{}, } msg := m.m @@ -199,15 +200,15 @@ func (fs *FlowState) CreateMessage(src string, dst string, ts time.Time, maxLen fs.mu.Lock() defer fs.mu.Unlock() - dstType := DataNode_SERVER - msg := &Msg{ + dstType := msgpb.DataNode_SERVER + msg := &msgpb.Msg{ Magic: proto.Uint64(constants.GetMagic()), Seq: Uint64ToNetworkBytes(fs.seq + 1), - Src: &DataNode{ + Src: &msgpb.DataNode{ Name: proto.String(src), TimestampUsec: Uint64ToNetworkBytes(uint64(ts.UnixNano()) / 1000), }, - Dst: &DataNode{ + Dst: &msgpb.DataNode{ Name: proto.String(dst), TimestampUsec: Uint64ToNetworkBytes(uint64(0)), Type: &dstType, diff --git a/message/message_test.go b/message/message_test.go index bc554227..28d85cc7 100644 --- a/message/message_test.go +++ b/message/message_test.go @@ -1,3 +1,17 @@ +// Copyright 2017-2018 Google Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package message import ( @@ -5,6 +19,7 @@ import ( "time" "github.com/golang/protobuf/proto" + msgpb "github.com/google/cloudprober/message/proto" ) // createMessage is a helper function for creating a message and fatally failing @@ -91,13 +106,13 @@ func TestInvalidMessage(t *testing.T) { } // Invalid magic. - msg := &Msg{ + msg := &msgpb.Msg{ Magic: proto.Uint64(constants.GetMagic() + 1), Seq: Uint64ToNetworkBytes(seq), - Src: &DataNode{ + Src: &msgpb.DataNode{ Name: proto.String(src), }, - Dst: &DataNode{ + Dst: &msgpb.DataNode{ Name: proto.String(dst), }, } diff --git a/message/message.pb.go b/message/proto/message.pb.go similarity index 59% rename from message/message.pb.go rename to message/proto/message.pb.go index ed9b4a07..9c7c9758 100644 --- a/message/message.pb.go +++ b/message/proto/message.pb.go @@ -1,25 +1,25 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/google/cloudprober/message/message.proto +// source: github.com/google/cloudprober/message/proto/message.proto /* -Package message is a generated protocol buffer package. +Package proto is a generated protocol buffer package. It is generated from these files: - github.com/google/cloudprober/message/message.proto + github.com/google/cloudprober/message/proto/message.proto It has these top-level messages: Constants DataNode Msg */ -package message +package proto -import proto "github.com/golang/protobuf/proto" +import proto1 "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal +var _ = proto1.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -27,7 +27,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package type DataNode_Type int32 @@ -54,10 +54,10 @@ func (x DataNode_Type) Enum() *DataNode_Type { return p } func (x DataNode_Type) String() string { - return proto.EnumName(DataNode_Type_name, int32(x)) + return proto1.EnumName(DataNode_Type_name, int32(x)) } func (x *DataNode_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(DataNode_Type_value, data, "DataNode_Type") + value, err := proto1.UnmarshalJSONEnum(DataNode_Type_value, data, "DataNode_Type") if err != nil { return err } @@ -73,7 +73,7 @@ type Constants struct { } func (m *Constants) Reset() { *m = Constants{} } -func (m *Constants) String() string { return proto.CompactTextString(m) } +func (m *Constants) String() string { return proto1.CompactTextString(m) } func (*Constants) ProtoMessage() {} func (*Constants) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } @@ -96,7 +96,7 @@ type DataNode struct { } func (m *DataNode) Reset() { *m = DataNode{} } -func (m *DataNode) String() string { return proto.CompactTextString(m) } +func (m *DataNode) String() string { return proto1.CompactTextString(m) } func (*DataNode) ProtoMessage() {} func (*DataNode) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } @@ -138,7 +138,7 @@ type Msg struct { } func (m *Msg) Reset() { *m = Msg{} } -func (m *Msg) String() string { return proto.CompactTextString(m) } +func (m *Msg) String() string { return proto1.CompactTextString(m) } func (*Msg) ProtoMessage() {} func (*Msg) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } @@ -185,37 +185,37 @@ func (m *Msg) GetPad() []byte { } func init() { - proto.RegisterType((*Constants)(nil), "message.Constants") - proto.RegisterType((*DataNode)(nil), "message.DataNode") - proto.RegisterType((*Msg)(nil), "message.Msg") - proto.RegisterEnum("message.DataNode_Type", DataNode_Type_name, DataNode_Type_value) + proto1.RegisterType((*Constants)(nil), "message.Constants") + proto1.RegisterType((*DataNode)(nil), "message.DataNode") + proto1.RegisterType((*Msg)(nil), "message.Msg") + proto1.RegisterEnum("message.DataNode_Type", DataNode_Type_name, DataNode_Type_value) } func init() { - proto.RegisterFile("github.com/google/cloudprober/message/message.proto", fileDescriptor0) + proto1.RegisterFile("github.com/google/cloudprober/message/proto/message.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 324 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x8f, 0xd1, 0x4e, 0xc2, 0x30, - 0x18, 0x85, 0x2d, 0x1b, 0x20, 0x3f, 0x88, 0xb3, 0x31, 0x66, 0x97, 0xcb, 0x0c, 0x91, 0xc4, 0x64, - 0x24, 0x5b, 0x64, 0xc8, 0x2d, 0x72, 0x61, 0xd4, 0x99, 0x54, 0xd0, 0x4b, 0x53, 0xd6, 0x66, 0x92, - 0xb0, 0xb5, 0xae, 0xe5, 0x82, 0x17, 0xf2, 0x01, 0x7c, 0x42, 0xb3, 0x8d, 0x19, 0x13, 0xf5, 0xaa, - 0xa7, 0x3d, 0x5f, 0xff, 0xff, 0x1c, 0x08, 0x92, 0xb5, 0x7e, 0xdb, 0xae, 0xbc, 0x58, 0xa4, 0xa3, - 0x44, 0x88, 0x64, 0xc3, 0x47, 0xf1, 0x46, 0x6c, 0x99, 0xcc, 0xc5, 0x8a, 0xe7, 0xa3, 0x94, 0x2b, - 0x45, 0x13, 0x5e, 0x9f, 0x9e, 0xcc, 0x85, 0x16, 0xb8, 0xbd, 0xbf, 0xba, 0x3e, 0x74, 0x66, 0x22, - 0x53, 0x9a, 0x66, 0x5a, 0xe1, 0x01, 0x34, 0x53, 0x9a, 0xac, 0x63, 0x1b, 0x39, 0x68, 0x68, 0x4e, - 0x8f, 0xfd, 0xab, 0x30, 0x9c, 0x84, 0x41, 0x70, 0x3d, 0x0e, 0x26, 0xe1, 0xd8, 0x27, 0x95, 0xeb, - 0x7e, 0x20, 0x38, 0xbc, 0xa1, 0x9a, 0x46, 0x82, 0x71, 0xec, 0x83, 0xa9, 0x77, 0x92, 0x97, 0x5f, - 0xfa, 0xfe, 0x99, 0x57, 0xef, 0xa9, 0x01, 0x6f, 0xb1, 0x93, 0x7c, 0xda, 0x9a, 0xdd, 0xdf, 0xce, - 0xa3, 0x05, 0x29, 0x59, 0x8c, 0xc1, 0xcc, 0x68, 0xca, 0xed, 0x86, 0x83, 0x86, 0x1d, 0x52, 0x6a, - 0x3c, 0x80, 0xbe, 0x5e, 0xa7, 0x5c, 0x69, 0x9a, 0xca, 0xd7, 0xad, 0xe2, 0xb1, 0x6d, 0x38, 0x68, - 0xd8, 0x23, 0x47, 0xdf, 0xaf, 0x4b, 0xc5, 0x63, 0xf7, 0x12, 0xcc, 0x62, 0x20, 0xee, 0x42, 0x7b, - 0x19, 0xdd, 0x45, 0x8f, 0x2f, 0x91, 0x75, 0x80, 0x01, 0xf6, 0xf3, 0x2d, 0x54, 0xe8, 0xa7, 0x39, - 0x79, 0x9e, 0x13, 0xab, 0xe1, 0x7e, 0x22, 0x30, 0x1e, 0x54, 0x82, 0x4f, 0x7f, 0xf6, 0x6a, 0xed, - 0x6b, 0x60, 0x0b, 0x0c, 0xc5, 0xdf, 0xcb, 0x10, 0x3d, 0x52, 0x48, 0x7c, 0x0e, 0x86, 0xca, 0xab, - 0xc5, 0x5d, 0xff, 0xe4, 0x57, 0x15, 0x52, 0xb8, 0x05, 0xc4, 0x94, 0xb6, 0xcd, 0x7f, 0x21, 0xa6, - 0x34, 0xbe, 0x80, 0x66, 0x26, 0x18, 0x57, 0x76, 0xd3, 0x31, 0xfe, 0xc6, 0x2a, 0xbf, 0x08, 0x21, - 0x29, 0xb3, 0xe3, 0x2a, 0x84, 0xa4, 0xec, 0x2b, 0x00, 0x00, 0xff, 0xff, 0x6e, 0x2a, 0x4b, 0xfe, - 0xd0, 0x01, 0x00, 0x00, + // 328 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x8f, 0x51, 0x4f, 0xfa, 0x30, + 0x14, 0xc5, 0xff, 0x65, 0x03, 0xfe, 0x5c, 0x10, 0x67, 0x63, 0xcc, 0x1e, 0x97, 0x19, 0x22, 0x89, + 0xc9, 0x96, 0x8c, 0xc8, 0x80, 0x57, 0xe4, 0xc1, 0xa8, 0x33, 0xa9, 0xa0, 0x8f, 0xa6, 0xac, 0xcd, + 0x24, 0x61, 0x6b, 0x5d, 0xcb, 0x03, 0x5f, 0xc8, 0x0f, 0xe0, 0x27, 0x34, 0xdb, 0x98, 0x31, 0x51, + 0xdf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, 0x1a, 0xee, 0x07, 0x02, 0xe3, 0x5e, 0x25, 0xf8, 0xf4, + 0x7b, 0xaf, 0xd6, 0xa1, 0x06, 0xb6, 0xc0, 0x50, 0xfc, 0xad, 0x0c, 0xd1, 0x23, 0xc5, 0x88, 0xcf, + 0xc1, 0x50, 0x79, 0x75, 0xb8, 0x1b, 0x9c, 0xfc, 0xa8, 0x42, 0x0a, 0xb7, 0x80, 0x98, 0xd2, 0xb6, + 0xf9, 0x27, 0xc4, 0x94, 0xc6, 0x17, 0xd0, 0xcc, 0x04, 0xe3, 0xca, 0x6e, 0x3a, 0xc6, 0xef, 0x58, + 0xe5, 0x17, 0x21, 0x24, 0x65, 0x76, 0x5c, 0x85, 0x90, 0x94, 0x7d, 0x06, 0x00, 0x00, 0xff, 0xff, + 0x14, 0x5b, 0xfc, 0x8a, 0xd6, 0x01, 0x00, 0x00, } diff --git a/message/message.proto b/message/proto/message.proto similarity index 100% rename from message/message.proto rename to message/proto/message.proto diff --git a/probes/http/cmd/http.go b/probes/http/cmd/http.go index 16eabe46..d8de24df 100644 --- a/probes/http/cmd/http.go +++ b/probes/http/cmd/http.go @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2017-2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/cloudprober/metrics" "github.com/google/cloudprober/probes/http" + configpb "github.com/google/cloudprober/probes/http/proto" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/targets" ) @@ -42,7 +43,7 @@ var ( func main() { flag.Parse() - c := &http.ProbeConf{} + c := &configpb.ProbeConf{} // If we are given a config file, read it. If not, use defaults. if *config != "" { diff --git a/probes/http/http.go b/probes/http/http.go index 571b13cd..7ed2e693 100644 --- a/probes/http/http.go +++ b/probes/http/http.go @@ -27,6 +27,7 @@ import ( "github.com/google/cloudprober/logger" "github.com/google/cloudprober/metrics" + configpb "github.com/google/cloudprober/probes/http/proto" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/probes/probeutils" ) @@ -39,7 +40,7 @@ const ( type Probe struct { name string opts *options.Options - c *ProbeConf + c *configpb.ProbeConf l *logger.Logger client *http.Client @@ -99,7 +100,7 @@ func (prr probeRunResult) Target() string { // Init initializes the probe with the given params. func (p *Probe) Init(name string, opts *options.Options) error { - c, ok := opts.ProbeConf.(*ProbeConf) + c, ok := opts.ProbeConf.(*configpb.ProbeConf) if !ok { return fmt.Errorf("no http config") } @@ -113,9 +114,9 @@ func (p *Probe) Init(name string, opts *options.Options) error { p.targets = p.opts.Targets.List() switch p.c.GetProtocol() { - case ProbeConf_HTTP: + case configpb.ProbeConf_HTTP: p.protocol = "http" - case ProbeConf_HTTPS: + case configpb.ProbeConf_HTTPS: p.protocol = "https" default: p.l.Errorf("Invalid Protocol: %s", p.c.GetProtocol()) diff --git a/probes/http/http_test.go b/probes/http/http_test.go index 9c1cf41d..03ce9658 100644 --- a/probes/http/http_test.go +++ b/probes/http/http_test.go @@ -21,6 +21,7 @@ import ( "time" "github.com/golang/protobuf/proto" + configpb "github.com/google/cloudprober/probes/http/proto" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/probes/probeutils" "github.com/google/cloudprober/targets" @@ -55,7 +56,7 @@ func TestRun(t *testing.T) { Targets: targets.StaticTargets("test.com"), Interval: 2 * time.Second, Timeout: time.Second, - ProbeConf: &ProbeConf{ + ProbeConf: &configpb.ProbeConf{ RequestsPerProbe: proto.Int32(1), StatsExportIntervalMsec: proto.Int32(1000), }, diff --git a/probes/http/config.pb.go b/probes/http/proto/config.pb.go similarity index 62% rename from probes/http/config.pb.go rename to probes/http/proto/config.pb.go index 55324ae4..b4591e3a 100644 --- a/probes/http/config.pb.go +++ b/probes/http/proto/config.pb.go @@ -1,23 +1,23 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/google/cloudprober/probes/http/config.proto +// source: github.com/google/cloudprober/probes/http/proto/config.proto /* -Package http is a generated protocol buffer package. +Package proto is a generated protocol buffer package. It is generated from these files: - github.com/google/cloudprober/probes/http/config.proto + github.com/google/cloudprober/probes/http/proto/config.proto It has these top-level messages: ProbeConf */ -package http +package proto -import proto "github.com/golang/protobuf/proto" +import proto1 "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal +var _ = proto1.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -25,7 +25,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package type ProbeConf_ProtocolType int32 @@ -49,10 +49,10 @@ func (x ProbeConf_ProtocolType) Enum() *ProbeConf_ProtocolType { return p } func (x ProbeConf_ProtocolType) String() string { - return proto.EnumName(ProbeConf_ProtocolType_name, int32(x)) + return proto1.EnumName(ProbeConf_ProtocolType_name, int32(x)) } func (x *ProbeConf_ProtocolType) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ProbeConf_ProtocolType_value, data, "ProbeConf_ProtocolType") + value, err := proto1.UnmarshalJSONEnum(ProbeConf_ProtocolType_value, data, "ProbeConf_ProtocolType") if err != nil { return err } @@ -85,7 +85,7 @@ type ProbeConf struct { } func (m *ProbeConf) Reset() { *m = ProbeConf{} } -func (m *ProbeConf) String() string { return proto.CompactTextString(m) } +func (m *ProbeConf) String() string { return proto1.CompactTextString(m) } func (*ProbeConf) ProtoMessage() {} func (*ProbeConf) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } @@ -153,37 +153,37 @@ func (m *ProbeConf) GetStatsExportIntervalMsec() int32 { } func init() { - proto.RegisterType((*ProbeConf)(nil), "cloudprober.probes.http.ProbeConf") - proto.RegisterEnum("cloudprober.probes.http.ProbeConf_ProtocolType", ProbeConf_ProtocolType_name, ProbeConf_ProtocolType_value) + proto1.RegisterType((*ProbeConf)(nil), "cloudprober.probes.http.ProbeConf") + proto1.RegisterEnum("cloudprober.probes.http.ProbeConf_ProtocolType", ProbeConf_ProtocolType_name, ProbeConf_ProtocolType_value) } func init() { - proto.RegisterFile("github.com/google/cloudprober/probes/http/config.proto", fileDescriptor0) + proto1.RegisterFile("github.com/google/cloudprober/probes/http/proto/config.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 356 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x41, 0x4f, 0xc2, 0x30, - 0x14, 0xc7, 0x1d, 0xb0, 0x04, 0x2a, 0x1a, 0xd2, 0x18, 0x59, 0x3c, 0x4d, 0xbc, 0x2c, 0x1e, 0xb6, - 0x41, 0xa2, 0x31, 0xdc, 0xd4, 0x68, 0xf4, 0x40, 0x82, 0x15, 0xcf, 0xcd, 0x28, 0x6f, 0x63, 0x49, - 0x59, 0x67, 0xdb, 0x11, 0xfd, 0xa8, 0x7e, 0x1b, 0xd3, 0x32, 0xc8, 0x3c, 0x78, 0xda, 0x5b, 0xdf, - 0xef, 0xf7, 0xf2, 0x7f, 0x0f, 0xdd, 0x66, 0xb9, 0x5e, 0x57, 0xcb, 0x90, 0x89, 0x4d, 0x94, 0x09, - 0x91, 0x71, 0x88, 0x18, 0x17, 0xd5, 0xaa, 0x94, 0x62, 0x09, 0x32, 0xb2, 0x1f, 0x15, 0xad, 0xb5, - 0x2e, 0x23, 0x26, 0x8a, 0x34, 0xcf, 0xc2, 0x52, 0x0a, 0x2d, 0xf0, 0xb0, 0x41, 0x85, 0x3b, 0x2a, - 0x34, 0xd4, 0xe8, 0xa7, 0x8d, 0x7a, 0x73, 0xf3, 0xff, 0x28, 0x8a, 0x14, 0xbf, 0xa1, 0xae, 0xe5, - 0x99, 0xe0, 0x9e, 0xe3, 0x3b, 0xc1, 0xe9, 0x24, 0x0a, 0xff, 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 0xd7, 0x9c, 0x31, 0xba, 0x42, 0xfd, 0xe6, 0xd5, 0x71, 0x17, 0xd9, 0xbb, 0x0f, 0x8e, 0x70, - 0x0f, 0xb9, 0xa6, 0x7a, 0x1f, 0x38, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x17, 0xb6, 0x4d, - 0x2d, 0x02, 0x00, 0x00, + // 357 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0x41, 0x4b, 0xc3, 0x30, + 0x14, 0xc7, 0xed, 0xb6, 0xc2, 0x16, 0xa7, 0x8c, 0x20, 0xae, 0x78, 0xaa, 0xf3, 0x52, 0x3c, 0xb4, + 0xdd, 0x40, 0x90, 0xe1, 0x45, 0x45, 0xd1, 0xc3, 0x60, 0xc6, 0x79, 0x0e, 0x5d, 0xf6, 0xda, 0x15, + 0xb2, 0xa6, 0x26, 0xe9, 0xd0, 0x8f, 0xea, 0xb7, 0x91, 0x64, 0xdd, 0xa8, 0x07, 0x4f, 0xfd, 0xa7, + 0xef, 0xf7, 0x7b, 0xbc, 0xf7, 0xd0, 0x5d, 0x96, 0xeb, 0x75, 0xb5, 0x0c, 0x99, 0xd8, 0x44, 0x99, + 0x10, 0x19, 0x87, 0x88, 0x71, 0x51, 0xad, 0x4a, 0x29, 0x96, 0x20, 0x23, 0xfb, 0x51, 0xd1, 0x5a, + 0xeb, 0xd2, 0x64, 0x2d, 0x22, 0x26, 0x8a, 0x34, 0xcf, 0x42, 0xfb, 0xc0, 0xc3, 0x06, 0x1b, 0xee, + 0xd8, 0xd0, 0xb0, 0xa3, 0x9f, 0x36, 0xea, 0xcd, 0xcd, 0xfb, 0x51, 0x14, 0x29, 0x7e, 0x43, 0x5d, + 0xcb, 0x33, 0xc1, 0x3d, 0xc7, 0x77, 0x82, 0xd3, 0x49, 0x14, 0xfe, 0x63, 0x86, 0x07, 0xcb, 0x24, + 0x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, 0xea, 0x37, 0xaf, 0x8e, 0xbb, 0xc8, 0xde, 0x7d, 0x70, + 0x84, 0x7b, 0xc8, 0x35, 0xe9, 0x7d, 0xe0, 0xfc, 0x06, 0x00, 0x00, 0xff, 0xff, 0x72, 0xf7, 0x99, + 0xaa, 0x33, 0x02, 0x00, 0x00, } diff --git a/probes/http/config.proto b/probes/http/proto/config.proto similarity index 100% rename from probes/http/config.proto rename to probes/http/proto/config.proto diff --git a/probes/ping/cmd/ping.go b/probes/ping/cmd/ping.go index d7c31ea2..363c51da 100644 --- a/probes/ping/cmd/ping.go +++ b/probes/ping/cmd/ping.go @@ -12,8 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -// This program implements a stand-alone ping prober binary using the cloudprober/ping package. It's intended -// to help prototype the ping package quickly and doesn't provide the facilities that cloudprober provides. +// This program implements a stand-alone ping prober binary using the +// cloudprober/ping package. It's intended to help prototype the ping package +// quickly and doesn't provide the facilities that cloudprober provides. package main import ( @@ -28,6 +29,7 @@ import ( "github.com/google/cloudprober/metrics" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/probes/ping" + configpb "github.com/google/cloudprober/probes/ping/proto" "github.com/google/cloudprober/targets" ) @@ -39,7 +41,7 @@ var ( func main() { flag.Parse() - probeConfig := &ping.ProbeConf{} + probeConfig := &configpb.ProbeConf{} if *config != "" { b, err := ioutil.ReadFile(*config) if err != nil { diff --git a/probes/ping/ping.go b/probes/ping/ping.go index 9424b118..d9d700d9 100644 --- a/probes/ping/ping.go +++ b/probes/ping/ping.go @@ -13,23 +13,25 @@ // limitations under the License. /* -Package ping implements a fast ping prober. It sends ICMP pings to a list of targets -and reports statistics on packets sent, received and latency experienced. +Package ping implements a fast ping prober. It sends ICMP pings to a list of +targets and reports statistics on packets sent, received and latency +experienced. -This ping implementation supports two types of sockets: Raw and datagram ICMP sockets. +This ping implementation supports two types of sockets: Raw and datagram ICMP +sockets. -Raw sockets require root privileges and all the ICMP noise is copied on all raw sockets -opened for ICMP. We have to deal with the unwanted ICMP noise. +Raw sockets require root privileges and all the ICMP noise is copied on all raw +sockets opened for ICMP. We have to deal with the unwanted ICMP noise. -On the other hand, datagram ICMP sockets are unprivileged and implemented in such a way -that kernel copies only relevant packets on them. Kernel assigns a local port for such -sockets and rewrites ICMP id of the outgoing packets to match that port number. Incoming -ICMP packets' ICMP id is matched with the local port to find the correct destination -socket. +On the other hand, datagram ICMP sockets are unprivileged and implemented in +such a way that kernel copies only relevant packets on them. Kernel assigns a +local port for such sockets and rewrites ICMP id of the outgoing packets to +match that port number. Incoming ICMP packets' ICMP id is matched with the +local port to find the correct destination socket. More about these sockets: http://lwn.net/Articles/420800/ -Note: On some linux distributions these sockets are not enabled by default; you can enable -them by doing something like the following: +Note: On some linux distributions these sockets are not enabled by default; you +can enable them by doing something like the following: sudo sysctl -w net.ipv4.ping_group_range="0 5000" */ package ping @@ -47,6 +49,7 @@ import ( "github.com/google/cloudprober/logger" "github.com/google/cloudprober/metrics" "github.com/google/cloudprober/probes/options" + configpb "github.com/google/cloudprober/probes/ping/proto" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" "golang.org/x/net/ipv6" @@ -62,7 +65,7 @@ const ( type Probe struct { name string opts *options.Options - c *ProbeConf + c *configpb.ProbeConf l *logger.Logger // book-keeping params @@ -88,7 +91,7 @@ var interfaceByName = func(s string) (addr, error) { return net.InterfaceByName( // Init initliazes the probe with the given params. func (p *Probe) Init(name string, opts *options.Options) error { - c, ok := opts.ProbeConf.(*ProbeConf) + c, ok := opts.ProbeConf.(*configpb.ProbeConf) if !ok { return errors.New("no ping config") } @@ -119,9 +122,9 @@ func (p *Probe) Init(name string, opts *options.Options) error { // for the replies. func (p *Probe) setSourceFromConfig() error { switch p.c.Source.(type) { - case *ProbeConf_SourceIp: + case *configpb.ProbeConf_SourceIp: p.source = p.c.GetSourceIp() - case *ProbeConf_SourceInterface: + case *configpb.ProbeConf_SourceInterface: s, err := resolveIntfAddr(p.c.GetSourceInterface()) if err != nil { return err diff --git a/probes/ping/ping_test.go b/probes/ping/ping_test.go index b9c005da..20218b4f 100644 --- a/probes/ping/ping_test.go +++ b/probes/ping/ping_test.go @@ -1,4 +1,4 @@ -// Copyright 2017 Google Inc. +// Copyright 2017-2018 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import ( "github.com/golang/protobuf/proto" "github.com/google/cloudprober/logger" "github.com/google/cloudprober/probes/options" + configpb "github.com/google/cloudprober/probes/ping/proto" "github.com/google/cloudprober/targets" "golang.org/x/net/icmp" "golang.org/x/net/ipv4" @@ -59,10 +60,10 @@ func replyPkt(pkt []byte, ipVersion int) []byte { type testICMPConn struct { sentPackets map[string](chan []byte) - c *ProbeConf + c *configpb.ProbeConf } -func newTestICMPConn(c *ProbeConf, targets []string) *testICMPConn { +func newTestICMPConn(c *configpb.ProbeConf, targets []string) *testICMPConn { tic := &testICMPConn{ c: c, sentPackets: make(map[string](chan []byte)), @@ -162,7 +163,7 @@ func sendAndCheckPackets(p *Probe, t *testing.T) { } } -func newProbe(c *ProbeConf, t []string) (*Probe, error) { +func newProbe(c *configpb.ProbeConf, t []string) (*Probe, error) { p := &Probe{ name: "ping_test", c: c, @@ -243,11 +244,11 @@ func TestInitSourceIP(t *testing.T) { } for _, r := range rows { - c := &ProbeConf{} + c := &configpb.ProbeConf{} if r.sourceIP != "" { - c.Source = &ProbeConf_SourceIp{r.sourceIP} + c.Source = &configpb.ProbeConf_SourceIp{r.sourceIP} } else { - c.Source = &ProbeConf_SourceInterface{r.sourceIntf} + c.Source = &configpb.ProbeConf_SourceInterface{r.sourceIntf} mockInterfaceByName(r.intf, r.intfAddrs) } p, err := newProbe(c, []string{}) @@ -266,8 +267,8 @@ func TestInitSourceIP(t *testing.T) { // Test sendPackets IPv4, raw sockets func TestSendPackets(t *testing.T) { - c := &ProbeConf{} - c.Source = &ProbeConf_SourceIp{"1.1.1.1"} + c := &configpb.ProbeConf{} + c.Source = &configpb.ProbeConf_SourceIp{"1.1.1.1"} p, err := newProbe(c, []string{"2.2.2.2", "3.3.3.3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -277,9 +278,9 @@ func TestSendPackets(t *testing.T) { // Test sendPackets IPv6, raw sockets func TestSendPacketsIPv6(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.IpVersion = proto.Int32(6) - c.Source = &ProbeConf_SourceIp{"::1"} + c.Source = &configpb.ProbeConf_SourceIp{"::1"} p, err := newProbe(c, []string{"::2", "::3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -289,9 +290,9 @@ func TestSendPacketsIPv6(t *testing.T) { // Test sendPackets IPv6, raw sockets, no packets should come on IPv4 target func TestSendPacketsIPv6ToIPv4Hosts(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.IpVersion = proto.Int32(6) - c.Source = &ProbeConf_SourceIp{"::1"} + c.Source = &configpb.ProbeConf_SourceIp{"::1"} p, err := newProbe(c, []string{"2.2.2.2"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -310,9 +311,9 @@ func TestSendPacketsIPv6ToIPv4Hosts(t *testing.T) { // Test sendPackets IPv4, datagram sockets func TestSendPacketsDatagramSocket(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.UseDatagramSocket = proto.Bool(true) - c.Source = &ProbeConf_SourceIp{"1.1.1.1"} + c.Source = &configpb.ProbeConf_SourceIp{"1.1.1.1"} p, err := newProbe(c, []string{"2.2.2.2", "3.3.3.3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -322,10 +323,10 @@ func TestSendPacketsDatagramSocket(t *testing.T) { // Test sendPackets IPv6, datagram sockets func TestSendPacketsIPv6DatagramSocket(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.UseDatagramSocket = proto.Bool(true) c.IpVersion = proto.Int32(6) - c.Source = &ProbeConf_SourceIp{"::1"} + c.Source = &configpb.ProbeConf_SourceIp{"::1"} p, err := newProbe(c, []string{"::2", "::3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -335,8 +336,8 @@ func TestSendPacketsIPv6DatagramSocket(t *testing.T) { // Test runProbe IPv4, raw sockets func TestRunProbe(t *testing.T) { - c := &ProbeConf{} - c.Source = &ProbeConf_SourceIp{"1.1.1.1"} + c := &configpb.ProbeConf{} + c.Source = &configpb.ProbeConf_SourceIp{"1.1.1.1"} p, err := newProbe(c, []string{"2.2.2.2", "3.3.3.3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -353,9 +354,9 @@ func TestRunProbe(t *testing.T) { // Test runProbe IPv6, raw sockets func TestRunProbeIPv6(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.IpVersion = proto.Int32(6) - c.Source = &ProbeConf_SourceIp{"::1"} + c.Source = &configpb.ProbeConf_SourceIp{"::1"} p, err := newProbe(c, []string{"::2", "::3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -372,9 +373,9 @@ func TestRunProbeIPv6(t *testing.T) { // Test runProbe IPv4, datagram sockets func TestRunProbeDatagram(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.UseDatagramSocket = proto.Bool(true) - c.Source = &ProbeConf_SourceIp{"1.1.1.1"} + c.Source = &configpb.ProbeConf_SourceIp{"1.1.1.1"} p, err := newProbe(c, []string{"2.2.2.2", "3.3.3.3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) @@ -391,10 +392,10 @@ func TestRunProbeDatagram(t *testing.T) { // Test runProbe IPv6, datagram sockets func TestRunProbeIPv6Datagram(t *testing.T) { - c := &ProbeConf{} + c := &configpb.ProbeConf{} c.UseDatagramSocket = proto.Bool(true) c.IpVersion = proto.Int32(6) - c.Source = &ProbeConf_SourceIp{"::1"} + c.Source = &configpb.ProbeConf_SourceIp{"::1"} p, err := newProbe(c, []string{"::2", "::3"}) if err != nil { t.Fatalf("Got error from newProbe: %v", err) diff --git a/probes/ping/config.pb.go b/probes/ping/proto/config.pb.go similarity index 65% rename from probes/ping/config.pb.go rename to probes/ping/proto/config.pb.go index b703360d..209a50a1 100644 --- a/probes/ping/config.pb.go +++ b/probes/ping/proto/config.pb.go @@ -1,23 +1,23 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/google/cloudprober/probes/ping/config.proto +// source: github.com/google/cloudprober/probes/ping/proto/config.proto /* -Package ping is a generated protocol buffer package. +Package proto is a generated protocol buffer package. It is generated from these files: - github.com/google/cloudprober/probes/ping/config.proto + github.com/google/cloudprober/probes/ping/proto/config.proto It has these top-level messages: ProbeConf */ -package ping +package proto -import proto "github.com/golang/protobuf/proto" +import proto1 "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal +var _ = proto1.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -25,7 +25,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package type ProbeConf struct { // Set the source address to send packets from, either by providing an address @@ -66,7 +66,7 @@ type ProbeConf struct { } func (m *ProbeConf) Reset() { *m = ProbeConf{} } -func (m *ProbeConf) String() string { return proto.CompactTextString(m) } +func (m *ProbeConf) String() string { return proto1.CompactTextString(m) } func (*ProbeConf) ProtoMessage() {} func (*ProbeConf) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } @@ -171,22 +171,22 @@ func (m *ProbeConf) GetDisableIntegrityCheck() bool { } // XXX_OneofFuncs is for the internal use of the proto package. -func (*ProbeConf) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { +func (*ProbeConf) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { return _ProbeConf_OneofMarshaler, _ProbeConf_OneofUnmarshaler, _ProbeConf_OneofSizer, []interface{}{ (*ProbeConf_SourceIp)(nil), (*ProbeConf_SourceInterface)(nil), } } -func _ProbeConf_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { +func _ProbeConf_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { m := msg.(*ProbeConf) // source switch x := m.Source.(type) { case *ProbeConf_SourceIp: - b.EncodeVarint(3<<3 | proto.WireBytes) + b.EncodeVarint(3<<3 | proto1.WireBytes) b.EncodeStringBytes(x.SourceIp) case *ProbeConf_SourceInterface: - b.EncodeVarint(4<<3 | proto.WireBytes) + b.EncodeVarint(4<<3 | proto1.WireBytes) b.EncodeStringBytes(x.SourceInterface) case nil: default: @@ -195,19 +195,19 @@ func _ProbeConf_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { return nil } -func _ProbeConf_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { +func _ProbeConf_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { m := msg.(*ProbeConf) switch tag { case 3: // source.source_ip - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Source = &ProbeConf_SourceIp{x} return true, err case 4: // source.source_interface - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Source = &ProbeConf_SourceInterface{x} @@ -217,17 +217,17 @@ func _ProbeConf_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buff } } -func _ProbeConf_OneofSizer(msg proto.Message) (n int) { +func _ProbeConf_OneofSizer(msg proto1.Message) (n int) { m := msg.(*ProbeConf) // source switch x := m.Source.(type) { case *ProbeConf_SourceIp: - n += proto.SizeVarint(3<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.SourceIp))) + n += proto1.SizeVarint(3<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(len(x.SourceIp))) n += len(x.SourceIp) case *ProbeConf_SourceInterface: - n += proto.SizeVarint(4<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.SourceInterface))) + n += proto1.SizeVarint(4<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(len(x.SourceInterface))) n += len(x.SourceInterface) case nil: default: @@ -237,38 +237,38 @@ func _ProbeConf_OneofSizer(msg proto.Message) (n int) { } func init() { - proto.RegisterType((*ProbeConf)(nil), "cloudprober.probes.ping.ProbeConf") + proto1.RegisterType((*ProbeConf)(nil), "cloudprober.probes.ping.ProbeConf") } func init() { - proto.RegisterFile("github.com/google/cloudprober/probes/ping/config.proto", fileDescriptor0) + proto1.RegisterFile("github.com/google/cloudprober/probes/ping/proto/config.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 388 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xcf, 0x6b, 0xdb, 0x30, - 0x14, 0xc7, 0x97, 0xf5, 0xc7, 0x6c, 0xb5, 0xa3, 0xab, 0x42, 0x56, 0x5d, 0x06, 0x66, 0x30, 0x08, - 0x8c, 0xd9, 0x50, 0xea, 0x1c, 0x3a, 0x76, 0x59, 0x37, 0x58, 0x0e, 0x83, 0xa2, 0x8e, 0x5d, 0x85, - 0x22, 0x3f, 0xab, 0xa2, 0x8e, 0x25, 0x24, 0x39, 0xac, 0xfd, 0xd3, 0x77, 0x2a, 0x96, 0xe4, 0x92, - 0x93, 0xf1, 0xfb, 0x7c, 0xbe, 0xef, 0x6b, 0xf3, 0xd0, 0x4a, 0x2a, 0x7f, 0x3f, 0x6c, 0x4a, 0xa1, - 0xb7, 0x95, 0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, 0xa7, 0x86, 0x3f, 0x76, 0x9a, 0x37, 0xcc, 0xa9, - 0x27, 0x20, 0x28, 0x7e, 0x62, 0xbd, 0xa2, 0x27, 0x69, 0x7e, 0xa7, 0x9e, 0x00, 0x17, 0x08, 0x29, - 0xc3, 0x76, 0x60, 0x9d, 0xd2, 0x3d, 0x39, 0x89, 0x5b, 0xaf, 0x68, 0xae, 0xcc, 0xdf, 0x38, 0xc3, - 0x57, 0x68, 0x3e, 0x38, 0x60, 0x0d, 0xf7, 0x5c, 0x5a, 0xbe, 0x65, 0x4e, 0x8f, 0x3f, 0x48, 0x4e, - 0x8b, 0xd9, 0x32, 0xbb, 0x3e, 0xf4, 0x76, 0x00, 0x7a, 0x3e, 0x38, 0xf8, 0x91, 0xf8, 0x5d, 0xc0, - 0xf8, 0x1b, 0xba, 0x68, 0x94, 0xe3, 0x9b, 0x2e, 0xde, 0x41, 0x5a, 0xe5, 0x1f, 0x99, 0xb8, 0x07, - 0xf1, 0x40, 0xde, 0x86, 0xe4, 0x51, 0xcb, 0x3b, 0x07, 0x74, 0x91, 0xac, 0xf5, 0x24, 0xdd, 0x8c, - 0xce, 0xf7, 0x0c, 0x1d, 0xc7, 0x5b, 0x3d, 0x07, 0x00, 0x00, 0xff, 0xff, 0x30, 0xa0, 0x86, 0x13, - 0x4e, 0x02, 0x00, 0x00, + // 389 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xdf, 0x6b, 0xd5, 0x30, + 0x18, 0x86, 0xad, 0xfb, 0x61, 0x9b, 0x4d, 0xe6, 0x72, 0x38, 0x2e, 0x37, 0x42, 0x11, 0x84, 0x03, + 0x62, 0x0b, 0x63, 0xdd, 0xc5, 0xd4, 0x1b, 0xa7, 0xe0, 0xb9, 0x10, 0x46, 0x26, 0xde, 0x86, 0x9c, + 0xf4, 0x6b, 0x16, 0xd6, 0xd3, 0x84, 0x24, 0x3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f8, 0x8f, 0x80, 0xe7, + 0x28, 0xfe, 0x8c, 0x88, 0x05, 0xa7, 0xfb, 0x1d, 0x30, 0xcf, 0xad, 0x7c, 0x5e, 0x4b, 0x8a, 0x39, + 0xf9, 0x36, 0x29, 0xbf, 0xa3, 0xf1, 0x14, 0xfe, 0x80, 0x8e, 0x0d, 0x7f, 0xe8, 0x35, 0x6f, 0x99, + 0x53, 0x8f, 0x40, 0x50, 0xfc, 0xc4, 0xe6, 0x92, 0x1e, 0xa5, 0xf9, 0xad, 0x7a, 0x04, 0x5c, 0x22, + 0xa4, 0x0c, 0xdb, 0x81, 0x75, 0x4a, 0x0f, 0xe4, 0x28, 0xde, 0x7a, 0x41, 0x0b, 0x65, 0xfe, 0xc4, + 0x19, 0xbe, 0x40, 0x8b, 0xd1, 0x01, 0x6b, 0xb9, 0xe7, 0xd2, 0xf2, 0x2d, 0x73, 0x7a, 0xfa, 0x41, + 0x72, 0x5c, 0x66, 0xab, 0xfc, 0x6a, 0xdf, 0xdb, 0x11, 0xe8, 0xe9, 0xe8, 0xe0, 0x7b, 0xe2, 0xb7, + 0x01, 0xe3, 0xaf, 0xe8, 0xac, 0x55, 0x8e, 0x6f, 0xfa, 0xb8, 0x07, 0x69, 0x95, 0x7f, 0x60, 0xe2, + 0x0e, 0xc4, 0x3d, 0x79, 0x1d, 0x92, 0x07, 0x1d, 0xef, 0x1d, 0xd0, 0x65, 0xb2, 0xd6, 0xb3, 0x74, + 0x3d, 0x39, 0xdf, 0x72, 0x74, 0x18, 0x77, 0xf5, 0x3f, 0x00, 0x00, 0xff, 0xff, 0x88, 0xc8, 0x51, + 0xfe, 0x54, 0x02, 0x00, 0x00, } diff --git a/probes/ping/config.proto b/probes/ping/proto/config.proto similarity index 100% rename from probes/ping/config.proto rename to probes/ping/proto/config.proto diff --git a/probes/probes.go b/probes/probes.go index 94541589..c02d83e8 100644 --- a/probes/probes.go +++ b/probes/probes.go @@ -33,6 +33,7 @@ import ( httpprobe "github.com/google/cloudprober/probes/http" "github.com/google/cloudprober/probes/options" "github.com/google/cloudprober/probes/ping" + configpb "github.com/google/cloudprober/probes/proto" "github.com/google/cloudprober/probes/udp" "github.com/google/cloudprober/probes/udplistener" "github.com/google/cloudprober/targets" @@ -79,7 +80,7 @@ func newLogger(probeName string) (*logger.Logger, error) { return logger.New(context.Background(), logsNamePrefix+"."+probeName) } -func getExtensionProbe(p *ProbeDef) (Probe, interface{}, error) { +func getExtensionProbe(p *configpb.ProbeDef) (Probe, interface{}, error) { extensions := proto.RegisteredExtensions(p) if len(extensions) > 1 { return nil, nil, fmt.Errorf("only one probe extension is allowed per probe, got %d extensions", len(extensions)) @@ -108,7 +109,7 @@ func getExtensionProbe(p *ProbeDef) (Probe, interface{}, error) { } // Init initializes the probes defined in the config. -func Init(probeProtobufs []*ProbeDef, globalTargetsOpts *targets.GlobalTargetsOptions, l *logger.Logger, sysVars map[string]string) (map[string]Probe, error) { +func Init(probeProtobufs []*configpb.ProbeDef, globalTargetsOpts *targets.GlobalTargetsOptions, l *logger.Logger, sysVars map[string]string) (map[string]Probe, error) { ldLister, err := lameduck.GetDefaultLister() if err != nil { l.Warningf("Error while getting default lameduck lister, lameduck behavior will be disabled. Err: %v", err) @@ -162,32 +163,32 @@ func Init(probeProtobufs []*ProbeDef, globalTargetsOpts *targets.GlobalTargetsOp return probes, nil } -func initProbe(p *ProbeDef, opts *options.Options) (probe Probe, err error) { +func initProbe(p *configpb.ProbeDef, opts *options.Options) (probe Probe, err error) { switch p.GetType() { - case ProbeDef_PING: + case configpb.ProbeDef_PING: probe = &ping.Probe{} opts.ProbeConf = p.GetPingProbe() - case ProbeDef_HTTP: + case configpb.ProbeDef_HTTP: probe = &httpprobe.Probe{} opts.ProbeConf = p.GetHttpProbe() - case ProbeDef_DNS: + case configpb.ProbeDef_DNS: probe = &dns.Probe{} opts.ProbeConf = p.GetDnsProbe() - case ProbeDef_EXTERNAL: + case configpb.ProbeDef_EXTERNAL: probe = &external.Probe{} opts.ProbeConf = p.GetExternalProbe() - case ProbeDef_UDP: + case configpb.ProbeDef_UDP: probe = &udp.Probe{} opts.ProbeConf = p.GetUdpProbe() - case ProbeDef_UDP_LISTENER: + case configpb.ProbeDef_UDP_LISTENER: probe = &udplistener.Probe{} opts.ProbeConf = p.GetUdpListenerProbe() - case ProbeDef_EXTENSION: + case configpb.ProbeDef_EXTENSION: probe, opts.ProbeConf, err = getExtensionProbe(p) if err != nil { return } - case ProbeDef_USER_DEFINED: + case configpb.ProbeDef_USER_DEFINED: userDefinedProbesMu.Lock() defer userDefinedProbesMu.Unlock() probe = userDefinedProbes[p.GetName()] diff --git a/probes/probes_test.go b/probes/probes_test.go index 0101e2ba..103c0ed8 100644 --- a/probes/probes_test.go +++ b/probes/probes_test.go @@ -23,6 +23,7 @@ import ( "github.com/google/cloudprober/metrics" "github.com/google/cloudprober/probes" "github.com/google/cloudprober/probes/options" + configpb "github.com/google/cloudprober/probes/proto" "github.com/google/cloudprober/probes/testdata" "github.com/google/cloudprober/targets" ) @@ -39,9 +40,9 @@ func (p *testProbe) Init(name string, opts *options.Options) error { func (p *testProbe) Start(ctx context.Context, dataChan chan *metrics.EventMetrics) {} func TestGetExtensionProbe(t *testing.T) { - probeDef := &probes.ProbeDef{ + probeDef := &configpb.ProbeDef{ Name: proto.String("ext-probe"), - Type: probes.ProbeDef_EXTENSION.Enum(), + Type: configpb.ProbeDef_EXTENSION.Enum(), Targets: &targets.TargetsDef{ Type: &targets.TargetsDef_DummyTargets{}, }, @@ -60,7 +61,7 @@ func TestGetExtensionProbe(t *testing.T) { if err != nil { t.Fatalf("error setting up extension in test probe proto: %v", err) } - probeMap, err := probes.Init([]*probes.ProbeDef{probeDef}, nil, &logger.Logger{}, make(map[string]string)) + probeMap, err := probes.Init([]*configpb.ProbeDef{probeDef}, nil, &logger.Logger{}, make(map[string]string)) if err == nil { t.Errorf("Expected error in building probe from extensions, got nil. Probes map: %v", probeMap) } @@ -71,7 +72,7 @@ func TestGetExtensionProbe(t *testing.T) { return &testProbe{} }) - probeMap, err = probes.Init([]*probes.ProbeDef{probeDef}, nil, &logger.Logger{}, make(map[string]string)) + probeMap, err = probes.Init([]*configpb.ProbeDef{probeDef}, nil, &logger.Logger{}, make(map[string]string)) if err != nil { t.Errorf("Got error in building probe from extensions: %v", err) } diff --git a/probes/config.pb.go b/probes/proto/config.pb.go similarity index 61% rename from probes/config.pb.go rename to probes/proto/config.pb.go index 1590e59c..26da0912 100644 --- a/probes/config.pb.go +++ b/probes/proto/config.pb.go @@ -1,31 +1,31 @@ // Code generated by protoc-gen-go. DO NOT EDIT. -// source: github.com/google/cloudprober/probes/config.proto +// source: github.com/google/cloudprober/probes/proto/config.proto /* -Package probes is a generated protocol buffer package. +Package proto is a generated protocol buffer package. It is generated from these files: - github.com/google/cloudprober/probes/config.proto + github.com/google/cloudprober/probes/proto/config.proto It has these top-level messages: ProbeDef */ -package probes +package proto -import proto "github.com/golang/protobuf/proto" +import proto1 "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" import cloudprober_metrics "github.com/google/cloudprober/metrics" -import cloudprober_probes_http "github.com/google/cloudprober/probes/http" +import cloudprober_probes_http "github.com/google/cloudprober/probes/http/proto" import cloudprober_probes_dns "github.com/google/cloudprober/probes/dns" import cloudprober_probes_external "github.com/google/cloudprober/probes/external" -import cloudprober_probes_ping "github.com/google/cloudprober/probes/ping" +import cloudprober_probes_ping "github.com/google/cloudprober/probes/ping/proto" import cloudprober_probes_udp "github.com/google/cloudprober/probes/udp" import cloudprober_probes_udplistener "github.com/google/cloudprober/probes/udplistener" import cloudprober_targets "github.com/google/cloudprober/targets" // Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal +var _ = proto1.Marshal var _ = fmt.Errorf var _ = math.Inf @@ -33,7 +33,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto1.ProtoPackageIsVersion2 // please upgrade the proto package type ProbeDef_Type int32 @@ -81,10 +81,10 @@ func (x ProbeDef_Type) Enum() *ProbeDef_Type { return p } func (x ProbeDef_Type) String() string { - return proto.EnumName(ProbeDef_Type_name, int32(x)) + return proto1.EnumName(ProbeDef_Type_name, int32(x)) } func (x *ProbeDef_Type) UnmarshalJSON(data []byte) error { - value, err := proto.UnmarshalJSONEnum(ProbeDef_Type_value, data, "ProbeDef_Type") + value, err := proto1.UnmarshalJSONEnum(ProbeDef_Type_value, data, "ProbeDef_Type") if err != nil { return err } @@ -118,21 +118,21 @@ type ProbeDef struct { // *ProbeDef_UdpProbe // *ProbeDef_UdpListenerProbe // *ProbeDef_UserDefinedProbe - Probe isProbeDef_Probe `protobuf_oneof:"probe"` - proto.XXX_InternalExtensions `json:"-"` - XXX_unrecognized []byte `json:"-"` + Probe isProbeDef_Probe `protobuf_oneof:"probe"` + proto1.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` } func (m *ProbeDef) Reset() { *m = ProbeDef{} } -func (m *ProbeDef) String() string { return proto.CompactTextString(m) } +func (m *ProbeDef) String() string { return proto1.CompactTextString(m) } func (*ProbeDef) ProtoMessage() {} func (*ProbeDef) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } -var extRange_ProbeDef = []proto.ExtensionRange{ +var extRange_ProbeDef = []proto1.ExtensionRange{ {200, 536870911}, } -func (*ProbeDef) ExtensionRangeArray() []proto.ExtensionRange { +func (*ProbeDef) ExtensionRangeArray() []proto1.ExtensionRange { return extRange_ProbeDef } @@ -287,7 +287,7 @@ func (m *ProbeDef) GetUserDefinedProbe() string { } // XXX_OneofFuncs is for the internal use of the proto package. -func (*ProbeDef) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { +func (*ProbeDef) XXX_OneofFuncs() (func(msg proto1.Message, b *proto1.Buffer) error, func(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error), func(msg proto1.Message) (n int), []interface{}) { return _ProbeDef_OneofMarshaler, _ProbeDef_OneofUnmarshaler, _ProbeDef_OneofSizer, []interface{}{ (*ProbeDef_PingProbe)(nil), (*ProbeDef_HttpProbe)(nil), @@ -299,42 +299,42 @@ func (*ProbeDef) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) erro } } -func _ProbeDef_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { +func _ProbeDef_OneofMarshaler(msg proto1.Message, b *proto1.Buffer) error { m := msg.(*ProbeDef) // probe switch x := m.Probe.(type) { case *ProbeDef_PingProbe: - b.EncodeVarint(20<<3 | proto.WireBytes) + b.EncodeVarint(20<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.PingProbe); err != nil { return err } case *ProbeDef_HttpProbe: - b.EncodeVarint(21<<3 | proto.WireBytes) + b.EncodeVarint(21<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.HttpProbe); err != nil { return err } case *ProbeDef_DnsProbe: - b.EncodeVarint(22<<3 | proto.WireBytes) + b.EncodeVarint(22<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.DnsProbe); err != nil { return err } case *ProbeDef_ExternalProbe: - b.EncodeVarint(23<<3 | proto.WireBytes) + b.EncodeVarint(23<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.ExternalProbe); err != nil { return err } case *ProbeDef_UdpProbe: - b.EncodeVarint(24<<3 | proto.WireBytes) + b.EncodeVarint(24<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.UdpProbe); err != nil { return err } case *ProbeDef_UdpListenerProbe: - b.EncodeVarint(25<<3 | proto.WireBytes) + b.EncodeVarint(25<<3 | proto1.WireBytes) if err := b.EncodeMessage(x.UdpListenerProbe); err != nil { return err } case *ProbeDef_UserDefinedProbe: - b.EncodeVarint(99<<3 | proto.WireBytes) + b.EncodeVarint(99<<3 | proto1.WireBytes) b.EncodeStringBytes(x.UserDefinedProbe) case nil: default: @@ -343,60 +343,60 @@ func _ProbeDef_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { return nil } -func _ProbeDef_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { +func _ProbeDef_OneofUnmarshaler(msg proto1.Message, tag, wire int, b *proto1.Buffer) (bool, error) { m := msg.(*ProbeDef) switch tag { case 20: // probe.ping_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_ping.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_PingProbe{msg} return true, err case 21: // probe.http_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_http.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_HttpProbe{msg} return true, err case 22: // probe.dns_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_dns.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_DnsProbe{msg} return true, err case 23: // probe.external_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_external.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_ExternalProbe{msg} return true, err case 24: // probe.udp_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_udp.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_UdpProbe{msg} return true, err case 25: // probe.udp_listener_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } msg := new(cloudprober_probes_udplistener.ProbeConf) err := b.DecodeMessage(msg) m.Probe = &ProbeDef_UdpListenerProbe{msg} return true, err case 99: // probe.user_defined_probe - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType + if wire != proto1.WireBytes { + return true, proto1.ErrInternalBadWireType } x, err := b.DecodeStringBytes() m.Probe = &ProbeDef_UserDefinedProbe{x} @@ -406,43 +406,43 @@ func _ProbeDef_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffe } } -func _ProbeDef_OneofSizer(msg proto.Message) (n int) { +func _ProbeDef_OneofSizer(msg proto1.Message) (n int) { m := msg.(*ProbeDef) // probe switch x := m.Probe.(type) { case *ProbeDef_PingProbe: - s := proto.Size(x.PingProbe) - n += proto.SizeVarint(20<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.PingProbe) + n += proto1.SizeVarint(20<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_HttpProbe: - s := proto.Size(x.HttpProbe) - n += proto.SizeVarint(21<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.HttpProbe) + n += proto1.SizeVarint(21<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_DnsProbe: - s := proto.Size(x.DnsProbe) - n += proto.SizeVarint(22<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.DnsProbe) + n += proto1.SizeVarint(22<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_ExternalProbe: - s := proto.Size(x.ExternalProbe) - n += proto.SizeVarint(23<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.ExternalProbe) + n += proto1.SizeVarint(23<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_UdpProbe: - s := proto.Size(x.UdpProbe) - n += proto.SizeVarint(24<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.UdpProbe) + n += proto1.SizeVarint(24<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_UdpListenerProbe: - s := proto.Size(x.UdpListenerProbe) - n += proto.SizeVarint(25<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) + s := proto1.Size(x.UdpListenerProbe) + n += proto1.SizeVarint(25<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(s)) n += s case *ProbeDef_UserDefinedProbe: - n += proto.SizeVarint(99<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(len(x.UserDefinedProbe))) + n += proto1.SizeVarint(99<<3 | proto1.WireBytes) + n += proto1.SizeVarint(uint64(len(x.UserDefinedProbe))) n += len(x.UserDefinedProbe) case nil: default: @@ -452,53 +452,55 @@ func _ProbeDef_OneofSizer(msg proto.Message) (n int) { } func init() { - proto.RegisterType((*ProbeDef)(nil), "cloudprober.probes.ProbeDef") - proto.RegisterEnum("cloudprober.probes.ProbeDef_Type", ProbeDef_Type_name, ProbeDef_Type_value) + proto1.RegisterType((*ProbeDef)(nil), "cloudprober.probes.ProbeDef") + proto1.RegisterEnum("cloudprober.probes.ProbeDef_Type", ProbeDef_Type_name, ProbeDef_Type_value) } -func init() { proto.RegisterFile("github.com/google/cloudprober/probes/config.proto", fileDescriptor0) } +func init() { + proto1.RegisterFile("github.com/google/cloudprober/probes/proto/config.proto", fileDescriptor0) +} var fileDescriptor0 = []byte{ - // 645 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xdf, 0x6e, 0xd3, 0x30, - 0x14, 0x87, 0xd7, 0x2c, 0x5d, 0x53, 0xb7, 0x9b, 0x22, 0xb3, 0x41, 0xd6, 0x1b, 0xca, 0x24, 0xa0, - 0xe3, 0x22, 0xed, 0x8a, 0x86, 0xc4, 0x24, 0x24, 0x60, 0x09, 0xac, 0x52, 0xc9, 0xaa, 0xb4, 0x93, - 0xe0, 0x2a, 0x6a, 0x63, 0xb7, 0xb3, 0xd4, 0x3a, 0x91, 0xff, 0x20, 0x76, 0xd7, 0xc7, 0xe3, 0x25, - 0x78, 0x17, 0x64, 0x27, 0x41, 0x0b, 0x6c, 0x53, 0xc5, 0x55, 0xa2, 0xe3, 0xef, 0xf7, 0xf9, 0x9c, - 0xc4, 0x06, 0x27, 0x0b, 0x22, 0xae, 0xe5, 0xcc, 0x8d, 0x93, 0x55, 0x77, 0x91, 0x24, 0x8b, 0x25, - 0xee, 0xc6, 0xcb, 0x44, 0xa2, 0x94, 0x25, 0x33, 0xcc, 0xba, 0xfa, 0xc1, 0xbb, 0x71, 0x42, 0xe7, - 0x64, 0xe1, 0xa6, 0x2c, 0x11, 0x09, 0x84, 0xb7, 0x00, 0x37, 0x03, 0x5a, 0xbd, 0x87, 0x35, 0x2b, - 0x2c, 0x18, 0x89, 0x79, 0x17, 0x11, 0x2e, 0x32, 0x4b, 0xeb, 0xcd, 0x46, 0x1b, 0x5f, 0x0b, 0x91, - 0x96, 0x76, 0x6f, 0x9d, 0x6e, 0x94, 0x43, 0xb4, 0xdc, 0x74, 0xeb, 0x6c, 0xa3, 0x18, 0xfe, 0x21, - 0x30, 0xa3, 0xd3, 0x65, 0x39, 0xbb, 0x59, 0xab, 0x29, 0xa1, 0x8b, 0xff, 0x69, 0x55, 0xa2, 0xbf, - 0x26, 0x7c, 0xb7, 0x69, 0x6c, 0x49, 0xb8, 0xc0, 0x14, 0xb3, 0x72, 0xfc, 0xf5, 0xc3, 0x71, 0x31, - 0x65, 0x0b, 0x2c, 0x78, 0xf1, 0xcc, 0x42, 0x47, 0xbf, 0x6a, 0xc0, 0x1a, 0x29, 0xc0, 0xc3, 0x73, - 0x08, 0x81, 0x49, 0xa7, 0x2b, 0xec, 0x54, 0xda, 0x46, 0xa7, 0x1e, 0xea, 0x77, 0x78, 0x0a, 0x4c, - 0x71, 0x93, 0x62, 0xc7, 0x68, 0x1b,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, 0xf9, 0xc5, 0x56, - 0x58, 0x57, 0x15, 0x5d, 0x50, 0x12, 0x75, 0x45, 0x72, 0xc9, 0xc1, 0xfd, 0x12, 0x45, 0x95, 0x25, - 0xaa, 0x92, 0x49, 0xde, 0x83, 0x3a, 0xa2, 0x3c, 0x77, 0x3c, 0xd6, 0x8e, 0x3b, 0x7f, 0x30, 0xa2, - 0xbc, 0xa4, 0xb0, 0x10, 0xe5, 0x99, 0xe1, 0x12, 0xec, 0x15, 0x57, 0x27, 0xd7, 0x3c, 0xd1, 0x9a, - 0x17, 0x77, 0x69, 0x0a, 0xb2, 0xe4, 0xda, 0x2d, 0xaa, 0x7f, 0x5a, 0x92, 0xa8, 0x18, 0xcb, 0xb9, - 0xbf, 0x25, 0x89, 0xca, 0x53, 0x59, 0x12, 0xe5, 0x43, 0x7d, 0x03, 0x50, 0x19, 0x8a, 0x3b, 0x92, - 0xab, 0x0e, 0xb5, 0xea, 0xf8, 0x1e, 0x55, 0x01, 0x97, 0x94, 0xb6, 0x44, 0xe9, 0x30, 0x5f, 0xc8, - 0xd4, 0x2e, 0x80, 0x92, 0x63, 0x16, 0x21, 0x3c, 0x27, 0x14, 0xa3, 0x5c, 0x1d, 0xab, 0xdf, 0xac, - 0x79, 0x8e, 0x99, 0x97, 0x2d, 0x69, 0xfe, 0x68, 0x05, 0x4c, 0x75, 0x25, 0xa0, 0x05, 0xcc, 0xd1, - 0x20, 0xf8, 0x6c, 0x6f, 0xa9, 0xb7, 0x8b, 0xc9, 0x64, 0x64, 0x57, 0x60, 0x0d, 0x6c, 0x7b, 0xc1, - 0xd8, 0x36, 0x60, 0x13, 0x58, 0xfe, 0xd7, 0x89, 0x1f, 0x06, 0x1f, 0x86, 0xf6, 0xb6, 0x2a, 0x5f, - 0x79, 0x23, 0xdb, 0x84, 0x36, 0x68, 0x5e, 0x79, 0xa3, 0x68, 0x38, 0x18, 0x4f, 0xfc, 0xc0, 0x0f, - 0xed, 0x2a, 0xdc, 0x05, 0x75, 0x05, 0x06, 0xe3, 0xc1, 0x65, 0x60, 0xcf, 0x34, 0x30, 0xf6, 0xc3, - 0xc8, 0xf3, 0x3f, 0x0d, 0x02, 0xdf, 0xb3, 0xe3, 0x57, 0x75, 0xeb, 0x67, 0xc5, 0x5e, 0xaf, 0xd7, - 0x6b, 0xe3, 0x63, 0x0d, 0x54, 0x75, 0x73, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xe9, 0x08, 0x02, - 0x12, 0xe7, 0x05, 0x00, 0x00, + // 647 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0xd1, 0x6e, 0xd3, 0x3c, + 0x14, 0xc7, 0xd7, 0x2c, 0x5d, 0x53, 0xb7, 0x9b, 0x22, 0x7f, 0xdb, 0x47, 0xb6, 0x1b, 0xca, 0x24, + 0xa0, 0xe3, 0x22, 0x2d, 0x45, 0x13, 0x62, 0x02, 0x09, 0x58, 0x02, 0xab, 0x54, 0xb2, 0x2a, 0xed, + 0x24, 0xb8, 0x8a, 0xda, 0xd8, 0xed, 0x2c, 0xb5, 0x4e, 0x14, 0xdb, 0x88, 0xdd, 0xf5, 0xf1, 0x78, + 0x09, 0xde, 0x05, 0xd9, 0x89, 0xd1, 0x22, 0xda, 0xa9, 0xe2, 0xca, 0xed, 0xf1, 0xef, 0xff, 0xcb, + 0x39, 0x89, 0x0d, 0x5e, 0xcf, 0x09, 0xbf, 0x15, 0x53, 0x37, 0x4e, 0x96, 0x9d, 0x79, 0x92, 0xcc, + 0x17, 0xb8, 0x13, 0x2f, 0x12, 0x81, 0xd2, 0x2c, 0x99, 0xe2, 0xac, 0xa3, 0x16, 0x26, 0x17, 0x9e, + 0x74, 0xe2, 0x84, 0xce, 0xc8, 0xdc, 0x55, 0x7f, 0x20, 0xbc, 0x87, 0xb9, 0x39, 0x76, 0xd2, 0x7d, + 0x58, 0xb6, 0xc4, 0x3c, 0x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x29, 0x54, 0xc7, 0x4a, 0x75, 0xb6, 0x41, 0xa5, 0xe1, 0x92, 0xd2, 0x16, 0x28, 0x1d, 0x14, + 0x1b, 0xb9, 0xda, 0x05, 0x50, 0x30, 0x9c, 0x45, 0x08, 0xcf, 0x08, 0xc5, 0xa8, 0x50, 0xc7, 0xf2, + 0x33, 0x2b, 0x9e, 0xe1, 0xcc, 0xcb, 0xb7, 0x14, 0x7f, 0xba, 0x04, 0xa6, 0xbc, 0x12, 0xd0, 0x02, + 0xe6, 0xb0, 0x1f, 0x7c, 0xb6, 0x77, 0xe4, 0xaf, 0xab, 0xf1, 0x78, 0x68, 0x57, 0x60, 0x0d, 0xec, + 0x7a, 0xc1, 0xc8, 0x36, 0x60, 0x13, 0x58, 0xfe, 0xd7, 0xb1, 0x1f, 0x06, 0x1f, 0x06, 0xf6, 0xae, + 0x2c, 0xdf, 0x78, 0x43, 0xdb, 0x84, 0x36, 0x68, 0xde, 0x78, 0xc3, 0x68, 0xd0, 0x1f, 0x8d, 0xfd, + 0xc0, 0x0f, 0xed, 0x2a, 0xdc, 0x07, 0x75, 0x09, 0x06, 0xa3, 0xfe, 0x75, 0x60, 0x4f, 0x15, 0x30, + 0xf2, 0xc3, 0xc8, 0xf3, 0x3f, 0xf5, 0x03, 0xdf, 0xb3, 0xe3, 0x17, 0x75, 0xeb, 0x67, 0xc5, 0x5e, + 0xad, 0x56, 0x2b, 0xe3, 0x63, 0x0d, 0x54, 0x55, 0x73, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0xce, + 0xed, 0xc6, 0x76, 0xf9, 0x05, 0x00, 0x00, } diff --git a/probes/config.proto b/probes/proto/config.proto similarity index 94% rename from probes/config.proto rename to probes/proto/config.proto index b19ec171..79023e61 100644 --- a/probes/config.proto +++ b/probes/proto/config.proto @@ -1,10 +1,10 @@ syntax = "proto2"; import "github.com/google/cloudprober/metrics/dist.proto"; -import "github.com/google/cloudprober/probes/http/config.proto"; +import "github.com/google/cloudprober/probes/http/proto/config.proto"; import "github.com/google/cloudprober/probes/dns/config.proto"; import "github.com/google/cloudprober/probes/external/config.proto"; -import "github.com/google/cloudprober/probes/ping/config.proto"; +import "github.com/google/cloudprober/probes/ping/proto/config.proto"; import "github.com/google/cloudprober/probes/udp/config.proto"; import "github.com/google/cloudprober/probes/udplistener/config.proto"; import "github.com/google/cloudprober/targets/targets.proto"; diff --git a/probes/testdata/testdata.pb.go b/probes/testdata/testdata.pb.go index 016de22d..7ff80485 100644 --- a/probes/testdata/testdata.pb.go +++ b/probes/testdata/testdata.pb.go @@ -15,7 +15,7 @@ package testdata import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import cloudprober_probes "github.com/google/cloudprober/probes" +import cloudprober_probes "github.com/google/cloudprober/probes/proto" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -64,16 +64,16 @@ func init() { } var fileDescriptor0 = []byte{ - // 168 bytes of a gzipped FileDescriptorProto + // 171 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xb2, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x4f, 0xce, 0xc9, 0x2f, 0x4d, 0x29, 0x28, 0xca, 0x4f, 0x4a, 0x2d, 0xd2, 0x07, 0x53, 0xc5, 0xfa, 0x25, 0xa9, 0xc5, 0x25, 0x29, 0x89, 0x25, 0x89, 0x70, 0x86, 0x5e, 0x41, 0x51, 0x7e, 0x49, 0xbe, 0x90, 0x34, - 0x92, 0x5a, 0x3d, 0x88, 0x5a, 0x3d, 0x98, 0x12, 0x29, 0x43, 0xa2, 0x8c, 0x4e, 0xce, 0xcf, 0x4b, - 0xcb, 0x4c, 0x87, 0x98, 0xa7, 0xa4, 0xc0, 0xc5, 0xe5, 0x96, 0x98, 0x97, 0x5c, 0x19, 0x00, 0x92, - 0x13, 0x12, 0xe2, 0x62, 0xc9, 0x4b, 0xcc, 0x4d, 0x95, 0x60, 0x54, 0x60, 0xd2, 0xe0, 0x0c, 0x02, - 0xb3, 0xad, 0xd2, 0xb9, 0xb8, 0xd3, 0x40, 0x2a, 0xe2, 0xc1, 0xda, 0x85, 0x64, 0xf4, 0xb0, 0xb8, - 0x00, 0xac, 0xdb, 0x25, 0x35, 0x4d, 0xe2, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0xba, 0x1e, - 0x1e, 0x67, 0xea, 0x21, 0x2c, 0x0c, 0xe2, 0x4a, 0x83, 0xb3, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x5c, 0xdf, 0x33, 0xe7, 0x19, 0x01, 0x00, 0x00, + 0x92, 0x5a, 0x3d, 0x88, 0x5a, 0x3d, 0x98, 0x12, 0x29, 0x73, 0xa2, 0x8c, 0x06, 0x1b, 0xa4, 0x9f, + 0x9c, 0x9f, 0x97, 0x96, 0x99, 0x0e, 0x31, 0x55, 0x49, 0x81, 0x8b, 0xcb, 0x2d, 0x31, 0x2f, 0xb9, + 0x32, 0x00, 0xa4, 0x42, 0x48, 0x88, 0x8b, 0x25, 0x2f, 0x31, 0x37, 0x55, 0x82, 0x51, 0x81, 0x49, + 0x83, 0x33, 0x08, 0xcc, 0xb6, 0x4a, 0xe7, 0xe2, 0x4e, 0x03, 0xa9, 0x88, 0x07, 0x1b, 0x22, 0x24, + 0xa3, 0x87, 0xc5, 0x1d, 0x60, 0xdd, 0x2e, 0xa9, 0x69, 0x12, 0x27, 0x18, 0x15, 0x18, 0x35, 0xb8, + 0x8d, 0xd4, 0xf5, 0xf0, 0x38, 0x56, 0x0f, 0x61, 0x61, 0x10, 0x57, 0x1a, 0x9c, 0x0d, 0x08, 0x00, + 0x00, 0xff, 0xff, 0x5b, 0x33, 0x00, 0xb5, 0x1f, 0x01, 0x00, 0x00, } diff --git a/probes/testdata/testdata.proto b/probes/testdata/testdata.proto index a9c075a7..cb01579a 100644 --- a/probes/testdata/testdata.proto +++ b/probes/testdata/testdata.proto @@ -1,6 +1,6 @@ syntax = "proto2"; -import "github.com/google/cloudprober/probes/config.proto"; +import "github.com/google/cloudprober/probes/proto/config.proto"; package cloudprober.probes.testdata;