client

package
v1.10.20 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgentHeaderName = "user-agent"
)

Variables

This section is empty.

Functions

func GetIPAddr

func GetIPAddr(ctx context.Context) (string, error)

GetIPAddr gets the client's IP address

func InjectLoggingMetadata

func InjectLoggingMetadata(ctx context.Context, log *logrus.Entry) *logrus.Entry

InjectLoggingMetadata injects client metadata into a logrus log entry

func MinVersionStreamServerInterceptor

func MinVersionStreamServerInterceptor() grpc.StreamServerInterceptor

MinVersionStreamServerInterceptor prevents versions below the minimum version from accessing lower version APIs.

func MinVersionUnaryServerInterceptor

func MinVersionUnaryServerInterceptor() grpc.UnaryServerInterceptor

MinVersionUnaryServerInterceptor prevents versions below the minimum version from accessing outdated APIs.

Types

type DeviceType

type DeviceType uint8
const (
	DeviceTypeUnknown DeviceType = iota
	DeviceTypeIOS
	DeviceTypeAndroid
)

func (DeviceType) IsMobile

func (t DeviceType) IsMobile() bool

func (DeviceType) String

func (t DeviceType) String() string

type UserAgent

type UserAgent struct {
	DeviceType DeviceType
	Version    Version
}

func GetUserAgent

func GetUserAgent(ctx context.Context) (*UserAgent, error)

GetUserAgent gets the Code client user agent value from headers in the provided context

func (*UserAgent) String

func (ua *UserAgent) String() string

type Version

type Version struct {
	Major int
	Minor int
	Patch int
}

func ParseVersion

func ParseVersion(value string) (*Version, error)

func (*Version) Before

func (v *Version) Before(other *Version) bool

func (*Version) GreaterThanOrEqualTo

func (v *Version) GreaterThanOrEqualTo(other *Version) bool

func (*Version) String

func (v *Version) String() string

Jump to

Keyboard shortcuts

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