// Code generated by protoc-gen-go-lite. DO NOT EDIT.
// protoc-gen-go-lite version: v0.11.0
// source: github.com/aperturerobotics/bifrost/transport/common/quic/quic.proto

package transport_quic

import (
	fmt "fmt"
	io "io"
	slices "slices"
	strconv "strconv"
	strings "strings"

	protobuf_go_lite "github.com/aperturerobotics/protobuf-go-lite"
	json "github.com/aperturerobotics/protobuf-go-lite/json"
)

type Opts struct {
	unknownFields []byte
	// MaxIdleTimeoutDur is the duration of idle after which conn is closed.
	//
	// Defaults to 10s.
	MaxIdleTimeoutDur string `protobuf:"bytes,1,opt,name=max_idle_timeout_dur,json=maxIdleTimeoutDur,proto3" json:"maxIdleTimeoutDur,omitempty"`
	// MaxIncomingStreams is the maximum number of concurrent bidirectional
	// streams that a peer is allowed to open.
	//
	// If unset or negative, defaults to 100000.
	MaxIncomingStreams int32 `protobuf:"varint,2,opt,name=max_incoming_streams,json=maxIncomingStreams,proto3" json:"maxIncomingStreams,omitempty"`
	// DisableKeepAlive disables the keep alive packets.
	DisableKeepAlive bool `protobuf:"varint,3,opt,name=disable_keep_alive,json=disableKeepAlive,proto3" json:"disableKeepAlive,omitempty"`
	// KeepAliveDur is the duration between keep-alive pings.
	//
	// If disable_keep_alive is set, this value is ignored.
	// If unset, sets keep-alive to half of MaxIdleTimeout.
	KeepAliveDur string `protobuf:"bytes,7,opt,name=keep_alive_dur,json=keepAliveDur,proto3" json:"keepAliveDur,omitempty"`
	// DisableDatagrams disables the unreliable datagrams feature.
	// Both peers must support it for it to be enabled, regardless of this flag.
	DisableDatagrams bool `protobuf:"varint,4,opt,name=disable_datagrams,json=disableDatagrams,proto3" json:"disableDatagrams,omitempty"`
	// DisablePathMtuDiscovery disables sending packets to discover max packet size.
	DisablePathMtuDiscovery bool `protobuf:"varint,5,opt,name=disable_path_mtu_discovery,json=disablePathMtuDiscovery,proto3" json:"disablePathMtuDiscovery,omitempty"`
	// Verbose indicates to use verbose logging.
	// Note: this is VERY verbose, logs every packet sent.
	Verbose bool `protobuf:"varint,6,opt,name=verbose,proto3" json:"verbose,omitempty"`
}

func (x *Opts) Reset() {
	*x = Opts{}
}

func (*Opts) ProtoMessage() {}

func (x *Opts) GetMaxIdleTimeoutDur() string {
	if x != nil {
		return x.MaxIdleTimeoutDur
	}
	return ""
}

func (x *Opts) GetMaxIncomingStreams() int32 {
	if x != nil {
		return x.MaxIncomingStreams
	}
	return 0
}

func (x *Opts) GetDisableKeepAlive() bool {
	if x != nil {
		return x.DisableKeepAlive
	}
	return false
}

func (x *Opts) GetKeepAliveDur() string {
	if x != nil {
		return x.KeepAliveDur
	}
	return ""
}

func (x *Opts) GetDisableDatagrams() bool {
	if x != nil {
		return x.DisableDatagrams
	}
	return false
}

func (x *Opts) GetDisablePathMtuDiscovery() bool {
	if x != nil {
		return x.DisablePathMtuDiscovery
	}
	return false
}

func (x *Opts) GetVerbose() bool {
	if x != nil {
		return x.Verbose
	}
	return false
}

func (m *Opts) CloneVT() *Opts {
	if m == nil {
		return (*Opts)(nil)
	}
	r := new(Opts)
	r.MaxIdleTimeoutDur = m.MaxIdleTimeoutDur
	r.MaxIncomingStreams = m.MaxIncomingStreams
	r.DisableKeepAlive = m.DisableKeepAlive
	r.KeepAliveDur = m.KeepAliveDur
	r.DisableDatagrams = m.DisableDatagrams
	r.DisablePathMtuDiscovery = m.DisablePathMtuDiscovery
	r.Verbose = m.Verbose
	if len(m.unknownFields) > 0 {
		r.unknownFields = slices.Clone(m.unknownFields)
	}
	return r
}

func (m *Opts) CloneMessageVT() protobuf_go_lite.CloneMessage {
	return m.CloneVT()
}

func (this *Opts) EqualVT(that *Opts) bool {
	if this == that {
		return true
	} else if this == nil || that == nil {
		return false
	}
	if this.MaxIdleTimeoutDur != that.MaxIdleTimeoutDur {
		return false
	}
	if this.MaxIncomingStreams != that.MaxIncomingStreams {
		return false
	}
	if this.DisableKeepAlive != that.DisableKeepAlive {
		return false
	}
	if this.DisableDatagrams != that.DisableDatagrams {
		return false
	}
	if this.DisablePathMtuDiscovery != that.DisablePathMtuDiscovery {
		return false
	}
	if this.Verbose != that.Verbose {
		return false
	}
	if this.KeepAliveDur != that.KeepAliveDur {
		return false
	}
	return string(this.unknownFields) == string(that.unknownFields)
}

func (this *Opts) EqualMessageVT(thatMsg any) bool {
	that, ok := thatMsg.(*Opts)
	if !ok {
		return false
	}
	return this.EqualVT(that)
}

// MarshalProtoJSON marshals the Opts message to JSON.
func (x *Opts) MarshalProtoJSON(s *json.MarshalState) {
	if x == nil {
		s.WriteNil()
		return
	}
	s.WriteObjectStart()
	var wroteField bool
	if x.MaxIdleTimeoutDur != "" || s.HasField("maxIdleTimeoutDur") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("maxIdleTimeoutDur")
		s.WriteString(x.MaxIdleTimeoutDur)
	}
	if x.MaxIncomingStreams != 0 || s.HasField("maxIncomingStreams") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("maxIncomingStreams")
		s.WriteInt32(x.MaxIncomingStreams)
	}
	if x.DisableKeepAlive || s.HasField("disableKeepAlive") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("disableKeepAlive")
		s.WriteBool(x.DisableKeepAlive)
	}
	if x.DisableDatagrams || s.HasField("disableDatagrams") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("disableDatagrams")
		s.WriteBool(x.DisableDatagrams)
	}
	if x.DisablePathMtuDiscovery || s.HasField("disablePathMtuDiscovery") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("disablePathMtuDiscovery")
		s.WriteBool(x.DisablePathMtuDiscovery)
	}
	if x.Verbose || s.HasField("verbose") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("verbose")
		s.WriteBool(x.Verbose)
	}
	if x.KeepAliveDur != "" || s.HasField("keepAliveDur") {
		s.WriteMoreIf(&wroteField)
		s.WriteObjectField("keepAliveDur")
		s.WriteString(x.KeepAliveDur)
	}
	s.WriteObjectEnd()
}

// MarshalJSON marshals the Opts to JSON.
func (x *Opts) MarshalJSON() ([]byte, error) {
	return json.DefaultMarshalerConfig.Marshal(x)
}

// UnmarshalProtoJSON unmarshals the Opts message from JSON.
func (x *Opts) UnmarshalProtoJSON(s *json.UnmarshalState) {
	if s.ReadNil() {
		return
	}
	s.ReadObject(func(key string) {
		switch key {
		default:
			s.Skip() // ignore unknown field
		case "max_idle_timeout_dur", "maxIdleTimeoutDur":
			s.AddField("max_idle_timeout_dur")
			x.MaxIdleTimeoutDur = s.ReadString()
		case "max_incoming_streams", "maxIncomingStreams":
			s.AddField("max_incoming_streams")
			x.MaxIncomingStreams = s.ReadInt32()
		case "disable_keep_alive", "disableKeepAlive":
			s.AddField("disable_keep_alive")
			x.DisableKeepAlive = s.ReadBool()
		case "disable_datagrams", "disableDatagrams":
			s.AddField("disable_datagrams")
			x.DisableDatagrams = s.ReadBool()
		case "disable_path_mtu_discovery", "disablePathMtuDiscovery":
			s.AddField("disable_path_mtu_discovery")
			x.DisablePathMtuDiscovery = s.ReadBool()
		case "verbose":
			s.AddField("verbose")
			x.Verbose = s.ReadBool()
		case "keep_alive_dur", "keepAliveDur":
			s.AddField("keep_alive_dur")
			x.KeepAliveDur = s.ReadString()
		}
	})
}

// UnmarshalJSON unmarshals the Opts from JSON.
func (x *Opts) UnmarshalJSON(b []byte) error {
	return json.DefaultUnmarshalerConfig.Unmarshal(b, x)
}

func (m *Opts) 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 *Opts) MarshalToVT(dAtA []byte) (int, error) {
	size := m.SizeVT()
	return m.MarshalToSizedBufferVT(dAtA[:size])
}

func (m *Opts) 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.KeepAliveDur) > 0 {
		i -= len(m.KeepAliveDur)
		copy(dAtA[i:], m.KeepAliveDur)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.KeepAliveDur)))
		i--
		dAtA[i] = 0x3a
	}
	if m.Verbose {
		i--
		if m.Verbose {
			dAtA[i] = 1
		} else {
			dAtA[i] = 0
		}
		i--
		dAtA[i] = 0x30
	}
	if m.DisablePathMtuDiscovery {
		i--
		if m.DisablePathMtuDiscovery {
			dAtA[i] = 1
		} else {
			dAtA[i] = 0
		}
		i--
		dAtA[i] = 0x28
	}
	if m.DisableDatagrams {
		i--
		if m.DisableDatagrams {
			dAtA[i] = 1
		} else {
			dAtA[i] = 0
		}
		i--
		dAtA[i] = 0x20
	}
	if m.DisableKeepAlive {
		i--
		if m.DisableKeepAlive {
			dAtA[i] = 1
		} else {
			dAtA[i] = 0
		}
		i--
		dAtA[i] = 0x18
	}
	if m.MaxIncomingStreams != 0 {
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(m.MaxIncomingStreams))
		i--
		dAtA[i] = 0x10
	}
	if len(m.MaxIdleTimeoutDur) > 0 {
		i -= len(m.MaxIdleTimeoutDur)
		copy(dAtA[i:], m.MaxIdleTimeoutDur)
		i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(len(m.MaxIdleTimeoutDur)))
		i--
		dAtA[i] = 0xa
	}
	return len(dAtA) - i, nil
}

func (m *Opts) SizeVT() (n int) {
	if m == nil {
		return 0
	}
	var l int
	_ = l
	l = len(m.MaxIdleTimeoutDur)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	if m.MaxIncomingStreams != 0 {
		n += 1 + protobuf_go_lite.SizeOfVarint(uint64(m.MaxIncomingStreams))
	}
	if m.DisableKeepAlive {
		n += 2
	}
	if m.DisableDatagrams {
		n += 2
	}
	if m.DisablePathMtuDiscovery {
		n += 2
	}
	if m.Verbose {
		n += 2
	}
	l = len(m.KeepAliveDur)
	if l > 0 {
		n += 1 + l + protobuf_go_lite.SizeOfVarint(uint64(l))
	}
	n += len(m.unknownFields)
	return n
}

func (x *Opts) MarshalProtoText() string {
	var sb strings.Builder
	sb.WriteString("Opts {")
	if x.MaxIdleTimeoutDur != "" {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("max_idle_timeout_dur: ")
		sb.WriteString(strconv.Quote(x.MaxIdleTimeoutDur))
	}
	if x.MaxIncomingStreams != 0 {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("max_incoming_streams: ")
		sb.WriteString(strconv.FormatInt(int64(x.MaxIncomingStreams), 10))
	}
	if x.DisableKeepAlive != false {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("disable_keep_alive: ")
		sb.WriteString(strconv.FormatBool(x.DisableKeepAlive))
	}
	if x.DisableDatagrams != false {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("disable_datagrams: ")
		sb.WriteString(strconv.FormatBool(x.DisableDatagrams))
	}
	if x.DisablePathMtuDiscovery != false {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("disable_path_mtu_discovery: ")
		sb.WriteString(strconv.FormatBool(x.DisablePathMtuDiscovery))
	}
	if x.Verbose != false {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("verbose: ")
		sb.WriteString(strconv.FormatBool(x.Verbose))
	}
	if x.KeepAliveDur != "" {
		if sb.Len() > 6 {
			sb.WriteString(" ")
		}
		sb.WriteString("keep_alive_dur: ")
		sb.WriteString(strconv.Quote(x.KeepAliveDur))
	}
	sb.WriteString("}")
	return sb.String()
}

func (x *Opts) String() string {
	return x.MarshalProtoText()
}
func (m *Opts) 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: Opts: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Opts: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field MaxIdleTimeoutDur", 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.MaxIdleTimeoutDur = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field MaxIncomingStreams", wireType)
			}
			m.MaxIncomingStreams = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.MaxIncomingStreams |= int32(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 3:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field DisableKeepAlive", wireType)
			}
			var v int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.DisableKeepAlive = bool(v != 0)
		case 4:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field DisableDatagrams", wireType)
			}
			var v int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.DisableDatagrams = bool(v != 0)
		case 5:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field DisablePathMtuDiscovery", wireType)
			}
			var v int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.DisablePathMtuDiscovery = bool(v != 0)
		case 6:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Verbose", wireType)
			}
			var v int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return protobuf_go_lite.ErrIntOverflow
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				v |= int(b&0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			m.Verbose = bool(v != 0)
		case 7:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field KeepAliveDur", 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.KeepAliveDur = 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
}
