-
Notifications
You must be signed in to change notification settings - Fork 8
/
static.pb.go
294 lines (273 loc) · 6.41 KB
/
static.pb.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.6.5
// source: github.com/aperturerobotics/bifrost/tptaddr/static/static.proto
package tptaddr_static
import (
fmt "fmt"
io "io"
strconv "strconv"
strings "strings"
protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
json "github.com/aperturerobotics/protobuf-go-lite/json"
)
// Config configures the static controller.
//
// Handles LookupTptAddr directives with a static list of addresses.
type Config struct {
unknownFields []byte
// Addresses is the mapping of peer id to address list.
//
// Format: {peer-id}|{transport-id}|{address}
// Anything after the second | is treated as part of the address.
Addresses []string `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"`
}
func (x *Config) Reset() {
*x = Config{}
}
func (*Config) ProtoMessage() {}
func (x *Config) GetAddresses() []string {
if x != nil {
return x.Addresses
}
return nil
}
func (m *Config) CloneVT() *Config {
if m == nil {
return (*Config)(nil)
}
r := new(Config)
if rhs := m.Addresses; rhs != nil {
tmpContainer := make([]string, len(rhs))
copy(tmpContainer, rhs)
r.Addresses = tmpContainer
}
if len(m.unknownFields) > 0 {
r.unknownFields = make([]byte, len(m.unknownFields))
copy(r.unknownFields, m.unknownFields)
}
return r
}
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage {
return m.CloneVT()
}
func (this *Config) EqualVT(that *Config) bool {
if this == that {
return true
} else if this == nil || that == nil {
return false
}
if len(this.Addresses) != len(that.Addresses) {
return false
}
for i, vx := range this.Addresses {
vy := that.Addresses[i]
if vx != vy {
return false
}
}
return string(this.unknownFields) == string(that.unknownFields)
}
func (this *Config) EqualMessageVT(thatMsg any) bool {
that, ok := thatMsg.(*Config)
if !ok {
return false
}
return this.EqualVT(that)
}
// MarshalProtoJSON marshals the Config message to JSON.
func (x *Config) MarshalProtoJSON(s *json.MarshalState) {
if x == nil {
s.WriteNil()
return
}
s.WriteObjectStart()
var wroteField bool
if len(x.Addresses) > 0 || s.HasField("addresses") {
s.WriteMoreIf(&wroteField)
s.WriteObjectField("addresses")
s.WriteStringArray(x.Addresses)
}
s.WriteObjectEnd()
}
// MarshalJSON marshals the Config to JSON.
func (x *Config) MarshalJSON() ([]byte, error) {
return json.DefaultMarshalerConfig.Marshal(x)
}
// UnmarshalProtoJSON unmarshals the Config message from JSON.
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState) {
if s.ReadNil() {
return
}
s.ReadObject(func(key string) {
switch key {
default:
s.Skip() // ignore unknown field
case "addresses":
s.AddField("addresses")
if s.ReadNil() {
x.Addresses = nil
return
}
x.Addresses = s.ReadStringArray()
}
})
}
// UnmarshalJSON unmarshals the Config from JSON.
func (x *Config) UnmarshalJSON(b []byte) error {
return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}
func (m *Config) MarshalVT() (dAtA []byte, err error) {
if m == nil {
return nil, nil
}
size := m.SizeVT()
dAtA = make([]byte, size)
n, err := m.MarshalToSizedBufferVT(dAtA[:size])
if err != nil {
return nil, err
}
return dAtA[:n], nil
}
func (m *Config) MarshalToVT(dAtA []byte) (int, error) {
size := m.SizeVT()
return m.MarshalToSizedBufferVT(dAtA[:size])
}
func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error) {
if m == nil {
return 0, nil
}
i := len(dAtA)
_ = i
var l int
_ = l
if m.unknownFields != nil {
i -= len(m.unknownFields)
copy(dAtA[i:], m.unknownFields)
}
if len(m.Addresses) > 0 {
for iNdEx := len(m.Addresses) - 1; iNdEx >= 0; iNdEx-- {
i -= len(m.Addresses[iNdEx])
copy(dAtA[i:], m.Addresses[iNdEx])
i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.Addresses[iNdEx])))
i--
dAtA[i] = 0xa
}
}
return len(dAtA) - i, nil
}
func (m *Config) SizeVT() (n int) {
if m == nil {
return 0
}
var l int
_ = l
if len(m.Addresses) > 0 {
for _, s := range m.Addresses {
l = len(s)
n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
}
}
n += len(m.unknownFields)
return n
}
func (x *Config) MarshalProtoText() string {
var sb strings.Builder
sb.WriteString("Config { ")
if len(x.Addresses) > 0 {
sb.WriteString(" addresses: [")
for i, v := range x.Addresses {
if i > 0 {
sb.WriteString(", ")
}
sb.WriteString(strconv.Quote(v))
}
sb.WriteString("]")
}
sb.WriteString("}")
return sb.String()
}
func (x *Config) String() string {
return x.MarshalProtoText()
}
func (m *Config) UnmarshalVT(dAtA []byte) error {
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return fmt.Errorf("proto: Config: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: Config: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
case 1:
if wireType != 2 {
return fmt.Errorf("proto: wrong wireType = %d for field Addresses", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protobuf_go_lite.ErrIntOverflow
}
if iNdEx >= l {
return io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protobuf_go_lite.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if postIndex > l {
return io.ErrUnexpectedEOF
}
m.Addresses = append(m.Addresses, string(dAtA[iNdEx:postIndex]))
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:])
if err != nil {
return err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protobuf_go_lite.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return io.ErrUnexpectedEOF
}
m.unknownFields = append(m.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
iNdEx += skippy
}
}
if iNdEx > l {
return io.ErrUnexpectedEOF
}
return nil
}