// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: envoy/config/transport_socket/capture/v2alpha/capture.proto

/*
	Package v2 is a generated protocol buffer package.

	It is generated from these files:
		envoy/config/transport_socket/capture/v2alpha/capture.proto

	It has these top-level messages:
		FileSink
		Capture
*/
package v2

import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import envoy_api_v2_core "github.com/envoyproxy/go-control-plane/envoy/api/v2/core"

import io "io"

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// 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.GoGoProtoPackageIsVersion2 // please upgrade the proto package

// File format.
type FileSink_Format int32

const (
	// Binary proto format as per :ref:`Trace
	// <envoy_api_msg_data.tap.v2alpha.Trace>`.
	FileSink_PROTO_BINARY FileSink_Format = 0
	// Text proto format as per :ref:`Trace
	// <envoy_api_msg_data.tap.v2alpha.Trace>`.
	FileSink_PROTO_TEXT FileSink_Format = 1
)

var FileSink_Format_name = map[int32]string{
	0: "PROTO_BINARY",
	1: "PROTO_TEXT",
}
var FileSink_Format_value = map[string]int32{
	"PROTO_BINARY": 0,
	"PROTO_TEXT":   1,
}

func (x FileSink_Format) String() string {
	return proto.EnumName(FileSink_Format_name, int32(x))
}
func (FileSink_Format) EnumDescriptor() ([]byte, []int) { return fileDescriptorCapture, []int{0, 0} }

// File sink.
//
// .. warning::
//
//   The current file sink implementation buffers the entire trace in memory
//   prior to writing. This will OOM for long lived sockets and/or where there
//   is a large amount of traffic on the socket.
type FileSink struct {
	// Path prefix. The output file will be of the form <path_prefix>_<id>.pb, where <id> is an
	// identifier distinguishing the recorded trace for individual socket instances (the Envoy
	// connection ID).
	PathPrefix string          `protobuf:"bytes,1,opt,name=path_prefix,json=pathPrefix,proto3" json:"path_prefix,omitempty"`
	Format     FileSink_Format `protobuf:"varint,2,opt,name=format,proto3,enum=envoy.config.transport_socket.capture.v2alpha.FileSink_Format" json:"format,omitempty"`
}

func (m *FileSink) Reset()                    { *m = FileSink{} }
func (m *FileSink) String() string            { return proto.CompactTextString(m) }
func (*FileSink) ProtoMessage()               {}
func (*FileSink) Descriptor() ([]byte, []int) { return fileDescriptorCapture, []int{0} }

func (m *FileSink) GetPathPrefix() string {
	if m != nil {
		return m.PathPrefix
	}
	return ""
}

func (m *FileSink) GetFormat() FileSink_Format {
	if m != nil {
		return m.Format
	}
	return FileSink_PROTO_BINARY
}

// Configuration for capture transport socket. This wraps another transport socket, providing the
// ability to interpose and record in plain text any traffic that is surfaced to Envoy.
type Capture struct {
	// Types that are valid to be assigned to SinkSelector:
	//	*Capture_FileSink
	SinkSelector isCapture_SinkSelector `protobuf_oneof:"sink_selector"`
	// The underlying transport socket being wrapped.
	TransportSocket *envoy_api_v2_core.TransportSocket `protobuf:"bytes,2,opt,name=transport_socket,json=transportSocket" json:"transport_socket,omitempty"`
}

func (m *Capture) Reset()                    { *m = Capture{} }
func (m *Capture) String() string            { return proto.CompactTextString(m) }
func (*Capture) ProtoMessage()               {}
func (*Capture) Descriptor() ([]byte, []int) { return fileDescriptorCapture, []int{1} }

type isCapture_SinkSelector interface {
	isCapture_SinkSelector()
	MarshalTo([]byte) (int, error)
	Size() int
}

type Capture_FileSink struct {
	FileSink *FileSink `protobuf:"bytes,1,opt,name=file_sink,json=fileSink,oneof"`
}

func (*Capture_FileSink) isCapture_SinkSelector() {}

func (m *Capture) GetSinkSelector() isCapture_SinkSelector {
	if m != nil {
		return m.SinkSelector
	}
	return nil
}

func (m *Capture) GetFileSink() *FileSink {
	if x, ok := m.GetSinkSelector().(*Capture_FileSink); ok {
		return x.FileSink
	}
	return nil
}

func (m *Capture) GetTransportSocket() *envoy_api_v2_core.TransportSocket {
	if m != nil {
		return m.TransportSocket
	}
	return nil
}

// XXX_OneofFuncs is for the internal use of the proto package.
func (*Capture) 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{}) {
	return _Capture_OneofMarshaler, _Capture_OneofUnmarshaler, _Capture_OneofSizer, []interface{}{
		(*Capture_FileSink)(nil),
	}
}

func _Capture_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
	m := msg.(*Capture)
	// sink_selector
	switch x := m.SinkSelector.(type) {
	case *Capture_FileSink:
		_ = b.EncodeVarint(1<<3 | proto.WireBytes)
		if err := b.EncodeMessage(x.FileSink); err != nil {
			return err
		}
	case nil:
	default:
		return fmt.Errorf("Capture.SinkSelector has unexpected type %T", x)
	}
	return nil
}

func _Capture_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) {
	m := msg.(*Capture)
	switch tag {
	case 1: // sink_selector.file_sink
		if wire != proto.WireBytes {
			return true, proto.ErrInternalBadWireType
		}
		msg := new(FileSink)
		err := b.DecodeMessage(msg)
		m.SinkSelector = &Capture_FileSink{msg}
		return true, err
	default:
		return false, nil
	}
}

func _Capture_OneofSizer(msg proto.Message) (n int) {
	m := msg.(*Capture)
	// sink_selector
	switch x := m.SinkSelector.(type) {
	case *Capture_FileSink:
		s := proto.Size(x.FileSink)
		n += proto.SizeVarint(1<<3 | proto.WireBytes)
		n += proto.SizeVarint(uint64(s))
		n += s
	case nil:
	default:
		panic(fmt.Sprintf("proto: unexpected type %T in oneof", x))
	}
	return n
}

func init() {
	proto.RegisterType((*FileSink)(nil), "envoy.config.transport_socket.capture.v2alpha.FileSink")
	proto.RegisterType((*Capture)(nil), "envoy.config.transport_socket.capture.v2alpha.Capture")
	proto.RegisterEnum("envoy.config.transport_socket.capture.v2alpha.FileSink_Format", FileSink_Format_name, FileSink_Format_value)
}
func (m *FileSink) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *FileSink) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.PathPrefix) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCapture(dAtA, i, uint64(len(m.PathPrefix)))
		i += copy(dAtA[i:], m.PathPrefix)
	}
	if m.Format != 0 {
		dAtA[i] = 0x10
		i++
		i = encodeVarintCapture(dAtA, i, uint64(m.Format))
	}
	return i, nil
}

func (m *Capture) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Capture) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.SinkSelector != nil {
		nn1, err := m.SinkSelector.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += nn1
	}
	if m.TransportSocket != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCapture(dAtA, i, uint64(m.TransportSocket.Size()))
		n2, err := m.TransportSocket.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n2
	}
	return i, nil
}

func (m *Capture_FileSink) MarshalTo(dAtA []byte) (int, error) {
	i := 0
	if m.FileSink != nil {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCapture(dAtA, i, uint64(m.FileSink.Size()))
		n3, err := m.FileSink.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n3
	}
	return i, nil
}
func encodeVarintCapture(dAtA []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return offset + 1
}
func (m *FileSink) Size() (n int) {
	var l int
	_ = l
	l = len(m.PathPrefix)
	if l > 0 {
		n += 1 + l + sovCapture(uint64(l))
	}
	if m.Format != 0 {
		n += 1 + sovCapture(uint64(m.Format))
	}
	return n
}

func (m *Capture) Size() (n int) {
	var l int
	_ = l
	if m.SinkSelector != nil {
		n += m.SinkSelector.Size()
	}
	if m.TransportSocket != nil {
		l = m.TransportSocket.Size()
		n += 1 + l + sovCapture(uint64(l))
	}
	return n
}

func (m *Capture_FileSink) Size() (n int) {
	var l int
	_ = l
	if m.FileSink != nil {
		l = m.FileSink.Size()
		n += 1 + l + sovCapture(uint64(l))
	}
	return n
}

func sovCapture(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
func sozCapture(x uint64) (n int) {
	return sovCapture(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *FileSink) Unmarshal(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 ErrIntOverflowCapture
			}
			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: FileSink: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: FileSink: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field PathPrefix", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCapture
				}
				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 ErrInvalidLengthCapture
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.PathPrefix = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Format", wireType)
			}
			m.Format = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCapture
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Format |= (FileSink_Format(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		default:
			iNdEx = preIndex
			skippy, err := skipCapture(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCapture
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *Capture) Unmarshal(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 ErrIntOverflowCapture
			}
			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: Capture: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Capture: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field FileSink", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCapture
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCapture
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			v := &FileSink{}
			if err := v.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			m.SinkSelector = &Capture_FileSink{v}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field TransportSocket", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCapture
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCapture
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.TransportSocket == nil {
				m.TransportSocket = &envoy_api_v2_core.TransportSocket{}
			}
			if err := m.TransportSocket.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCapture(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCapture
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipCapture(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowCapture
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCapture
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
			return iNdEx, nil
		case 1:
			iNdEx += 8
			return iNdEx, nil
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCapture
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			iNdEx += length
			if length < 0 {
				return 0, ErrInvalidLengthCapture
			}
			return iNdEx, nil
		case 3:
			for {
				var innerWire uint64
				var start int = iNdEx
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return 0, ErrIntOverflowCapture
					}
					if iNdEx >= l {
						return 0, io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					innerWire |= (uint64(b) & 0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				innerWireType := int(innerWire & 0x7)
				if innerWireType == 4 {
					break
				}
				next, err := skipCapture(dAtA[start:])
				if err != nil {
					return 0, err
				}
				iNdEx = start + next
			}
			return iNdEx, nil
		case 4:
			return iNdEx, nil
		case 5:
			iNdEx += 4
			return iNdEx, nil
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
	}
	panic("unreachable")
}

var (
	ErrInvalidLengthCapture = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCapture   = fmt.Errorf("proto: integer overflow")
)

func init() {
	proto.RegisterFile("envoy/config/transport_socket/capture/v2alpha/capture.proto", fileDescriptorCapture)
}

var fileDescriptorCapture = []byte{
	// 328 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x91, 0x41, 0x4b, 0xc3, 0x30,
	0x18, 0x86, 0x97, 0x1d, 0xe6, 0xf6, 0x4d, 0xb7, 0xd2, 0xd3, 0x10, 0x99, 0xa3, 0xa7, 0x21,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