| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
package quicv3 |
| 8 |
|
| 9 |
import ( |
| 10 |
protohelpers "github.com/planetscale/vtprotobuf/protohelpers" |
| 11 |
wrapperspb "github.com/planetscale/vtprotobuf/types/known/wrapperspb" |
| 12 |
proto "google.golang.org/protobuf/proto" |
| 13 |
protoimpl "google.golang.org/protobuf/runtime/protoimpl" |
| 14 |
) |
| 15 |
|
| 16 |
const ( |
| 17 |
|
| 18 |
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) |
| 19 |
|
| 20 |
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) |
| 21 |
) |
| 22 |
|
| 23 |
func (m *QuicDownstreamTransport) MarshalVTStrict() (dAtA []byte, err error) { |
| 24 |
if m == nil { |
| 25 |
return nil, nil |
| 26 |
} |
| 27 |
size := m.SizeVT() |
| 28 |
dAtA = make([]byte, size) |
| 29 |
n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) |
| 30 |
if err != nil { |
| 31 |
return nil, err |
| 32 |
} |
| 33 |
return dAtA[:n], nil |
| 34 |
} |
| 35 |
|
| 36 |
func (m *QuicDownstreamTransport) MarshalToVTStrict(dAtA []byte) (int, error) { |
| 37 |
size := m.SizeVT() |
| 38 |
return m.MarshalToSizedBufferVTStrict(dAtA[:size]) |
| 39 |
} |
| 40 |
|
| 41 |
func (m *QuicDownstreamTransport) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { |
| 42 |
if m == nil { |
| 43 |
return 0, nil |
| 44 |
} |
| 45 |
i := len(dAtA) |
| 46 |
_ = i |
| 47 |
var l int |
| 48 |
_ = l |
| 49 |
if m.unknownFields != nil { |
| 50 |
i -= len(m.unknownFields) |
| 51 |
copy(dAtA[i:], m.unknownFields) |
| 52 |
} |
| 53 |
if m.EnableEarlyData != nil { |
| 54 |
size, err := (*wrapperspb.BoolValue)(m.EnableEarlyData).MarshalToSizedBufferVTStrict(dAtA[:i]) |
| 55 |
if err != nil { |
| 56 |
return 0, err |
| 57 |
} |
| 58 |
i -= size |
| 59 |
i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) |
| 60 |
i-- |
| 61 |
dAtA[i] = 0x12 |
| 62 |
} |
| 63 |
if m.DownstreamTlsContext != nil { |
| 64 |
if vtmsg, ok := interface{}(m.DownstreamTlsContext).(interface { |
| 65 |
MarshalToSizedBufferVTStrict([]byte) (int, error) |
| 66 |
}); ok { |
| 67 |
size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) |
| 68 |
if err != nil { |
| 69 |
return 0, err |
| 70 |
} |
| 71 |
i -= size |
| 72 |
i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) |
| 73 |
} else { |
| 74 |
encoded, err := proto.Marshal(m.DownstreamTlsContext) |
| 75 |
if err != nil { |
| 76 |
return 0, err |
| 77 |
} |
| 78 |
i -= len(encoded) |
| 79 |
copy(dAtA[i:], encoded) |
| 80 |
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) |
| 81 |
} |
| 82 |
i-- |
| 83 |
dAtA[i] = 0xa |
| 84 |
} |
| 85 |
return len(dAtA) - i, nil |
| 86 |
} |
| 87 |
|
| 88 |
func (m *QuicUpstreamTransport) MarshalVTStrict() (dAtA []byte, err error) { |
| 89 |
if m == nil { |
| 90 |
return nil, nil |
| 91 |
} |
| 92 |
size := m.SizeVT() |
| 93 |
dAtA = make([]byte, size) |
| 94 |
n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size]) |
| 95 |
if err != nil { |
| 96 |
return nil, err |
| 97 |
} |
| 98 |
return dAtA[:n], nil |
| 99 |
} |
| 100 |
|
| 101 |
func (m *QuicUpstreamTransport) MarshalToVTStrict(dAtA []byte) (int, error) { |
| 102 |
size := m.SizeVT() |
| 103 |
return m.MarshalToSizedBufferVTStrict(dAtA[:size]) |
| 104 |
} |
| 105 |
|
| 106 |
func (m *QuicUpstreamTransport) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { |
| 107 |
if m == nil { |
| 108 |
return 0, nil |
| 109 |
} |
| 110 |
i := len(dAtA) |
| 111 |
_ = i |
| 112 |
var l int |
| 113 |
_ = l |
| 114 |
if m.unknownFields != nil { |
| 115 |
i -= len(m.unknownFields) |
| 116 |
copy(dAtA[i:], m.unknownFields) |
| 117 |
} |
| 118 |
if m.UpstreamTlsContext != nil { |
| 119 |
if vtmsg, ok := interface{}(m.UpstreamTlsContext).(interface { |
| 120 |
MarshalToSizedBufferVTStrict([]byte) (int, error) |
| 121 |
}); ok { |
| 122 |
size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i]) |
| 123 |
if err != nil { |
| 124 |
return 0, err |
| 125 |
} |
| 126 |
i -= size |
| 127 |
i = protohelpers.EncodeVarint(dAtA, i, uint64(size)) |
| 128 |
} else { |
| 129 |
encoded, err := proto.Marshal(m.UpstreamTlsContext) |
| 130 |
if err != nil { |
| 131 |
return 0, err |
| 132 |
} |
| 133 |
i -= len(encoded) |
| 134 |
copy(dAtA[i:], encoded) |
| 135 |
i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded))) |
| 136 |
} |
| 137 |
i-- |
| 138 |
dAtA[i] = 0xa |
| 139 |
} |
| 140 |
return len(dAtA) - i, nil |
| 141 |
} |
| 142 |
|
| 143 |
func (m *QuicDownstreamTransport) SizeVT() (n int) { |
| 144 |
if m == nil { |
| 145 |
return 0 |
| 146 |
} |
| 147 |
var l int |
| 148 |
_ = l |
| 149 |
if m.DownstreamTlsContext != nil { |
| 150 |
if size, ok := interface{}(m.DownstreamTlsContext).(interface { |
| 151 |
SizeVT() int |
| 152 |
}); ok { |
| 153 |
l = size.SizeVT() |
| 154 |
} else { |
| 155 |
l = proto.Size(m.DownstreamTlsContext) |
| 156 |
} |
| 157 |
n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 158 |
} |
| 159 |
if m.EnableEarlyData != nil { |
| 160 |
l = (*wrapperspb.BoolValue)(m.EnableEarlyData).SizeVT() |
| 161 |
n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 162 |
} |
| 163 |
n += len(m.unknownFields) |
| 164 |
return n |
| 165 |
} |
| 166 |
|
| 167 |
func (m *QuicUpstreamTransport) SizeVT() (n int) { |
| 168 |
if m == nil { |
| 169 |
return 0 |
| 170 |
} |
| 171 |
var l int |
| 172 |
_ = l |
| 173 |
if m.UpstreamTlsContext != nil { |
| 174 |
if size, ok := interface{}(m.UpstreamTlsContext).(interface { |
| 175 |
SizeVT() int |
| 176 |
}); ok { |
| 177 |
l = size.SizeVT() |
| 178 |
} else { |
| 179 |
l = proto.Size(m.UpstreamTlsContext) |
| 180 |
} |
| 181 |
n += 1 + l + protohelpers.SizeOfVarint(uint64(l)) |
| 182 |
} |
| 183 |
n += len(m.unknownFields) |
| 184 |
return n |
| 185 |
} |