proxy

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 9 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthProxy        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProxy          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupProxy = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	Endian = binary.LittleEndian
)
View Source
var (
	// Version0 is the first version, whose major and minor are both -1.
	Version0 = Version{Major: 1, Minor: 0, Patch: 0}
)

Functions

This section is empty.

Types

type Codec added in v1.1.0

type Codec interface {
	// Marshal encodes the extra info and the version then returns bytes.
	Marshal(version Version) ([]byte, error)
	// Unmarshal decodes information from the bytes.
	Unmarshal([]byte) error
}

type ExtraInfo added in v1.0.0

type ExtraInfo interface {
	Codec
	InfoFetcher
}

ExtraInfo is the extra information between proxy and cn.

type ExtraInfoV0 added in v1.1.0

type ExtraInfoV0 struct {
	// Salt is the bytes in MySQL protocol which is 20 length.
	Salt []byte
	// InternalConn indicates whether the connection is from internal
	// network or external network. false means that it is external, otherwise,
	// it is internal.
	InternalConn bool
	// ConnectionID sent from proxy, cn side should update its connection ID.
	ConnectionID uint32
	// Label is the requested label from client.
	Label RequestLabel
}

ExtraInfoV0 is the information that proxy send to CN when build connection in handshake phase.

func (*ExtraInfoV0) GetConnectionID added in v1.1.0

func (i *ExtraInfoV0) GetConnectionID() (uint32, bool)

GetConnectionID implements the InfoFetcher interface.

func (*ExtraInfoV0) GetInternalConn added in v1.1.0

func (i *ExtraInfoV0) GetInternalConn() (bool, bool)

GetInternalConn implements the InfoFetcher interface.

func (*ExtraInfoV0) GetLabel added in v1.1.0

func (i *ExtraInfoV0) GetLabel() (RequestLabel, bool)

GetLabel implements the InfoFetcher interface.

func (*ExtraInfoV0) GetSalt added in v1.1.0

func (i *ExtraInfoV0) GetSalt() ([]byte, bool)

GetSalt implements the InfoFetcher interface.

func (*ExtraInfoV0) Marshal added in v1.1.0

func (i *ExtraInfoV0) Marshal(v Version) ([]byte, error)

Marshal implements the Codec interface.

func (*ExtraInfoV0) Unmarshal added in v1.1.0

func (i *ExtraInfoV0) Unmarshal(data []byte) error

Unmarshal implements the Codec interface.

type InfoFetcher added in v1.1.0

type InfoFetcher interface {
	// GetSalt returns the salt value.
	GetSalt() ([]byte, bool)
	// GetInternalConn returns the internal conn value.
	GetInternalConn() (bool, bool)
	// GetConnectionID returns the connection ID value.
	GetConnectionID() (uint32, bool)
	// GetLabel returns the label value.
	GetLabel() (RequestLabel, bool)
}

InfoFetcher is the interface used to fetch information. The last return value of all methods in the interface must be a boolean value to indicates whether the method is supported by the version.

type RequestLabel

type RequestLabel struct {
	Labels               map[string]string `` /* 153-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*RequestLabel) Descriptor

func (*RequestLabel) Descriptor() ([]byte, []int)

func (*RequestLabel) GetLabels

func (m *RequestLabel) GetLabels() map[string]string

func (*RequestLabel) Marshal

func (m *RequestLabel) Marshal() (dAtA []byte, err error)

func (*RequestLabel) MarshalTo

func (m *RequestLabel) MarshalTo(dAtA []byte) (int, error)

func (*RequestLabel) MarshalToSizedBuffer

func (m *RequestLabel) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*RequestLabel) ProtoMessage

func (*RequestLabel) ProtoMessage()

func (*RequestLabel) Reset

func (m *RequestLabel) Reset()

func (*RequestLabel) Size

func (m *RequestLabel) Size() (n int)

func (*RequestLabel) String

func (m *RequestLabel) String() string

func (*RequestLabel) Unmarshal

func (m *RequestLabel) Unmarshal(dAtA []byte) error

func (*RequestLabel) XXX_DiscardUnknown

func (m *RequestLabel) XXX_DiscardUnknown()

func (*RequestLabel) XXX_Marshal

func (m *RequestLabel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RequestLabel) XXX_Merge

func (m *RequestLabel) XXX_Merge(src proto.Message)

func (*RequestLabel) XXX_Size

func (m *RequestLabel) XXX_Size() int

func (*RequestLabel) XXX_Unmarshal

func (m *RequestLabel) XXX_Unmarshal(b []byte) error

type Version added in v1.1.0

type Version struct {
	Major int32
	Minor int32
	Patch int32
}

Version is used to control proxy and cn version to keep them compatibility.

func (*Version) Decode added in v1.1.0

func (v *Version) Decode(data []byte) error

func (*Version) Encode added in v1.1.0

func (v *Version) Encode() ([]byte, error)

func (*Version) GE added in v1.1.0

func (v *Version) GE(v1 Version) bool

type VersionedExtraInfo added in v1.1.0

type VersionedExtraInfo struct {
	// Version defines the version of extra info.
	Version   Version
	ExtraInfo ExtraInfo
}

func NewVersionedExtraInfo added in v1.1.0

func NewVersionedExtraInfo(v Version, i ExtraInfo) *VersionedExtraInfo

NewVersionedExtraInfo creates a new ExtraInfo instance with specified version.

func (*VersionedExtraInfo) Decode added in v1.1.0

func (e *VersionedExtraInfo) Decode(reader *bufio.Reader) error

func (*VersionedExtraInfo) Encode added in v1.1.0

func (e *VersionedExtraInfo) Encode() ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL