Documentation
¶
Index ¶
- Constants
- func GetIPAddr(ctx context.Context) (string, error)
- func InjectLoggingMetadata(ctx context.Context, log *zap.Logger, userAgentName string) *zap.Logger
- func MinVersionStreamServerInterceptor(userAgentNames ...string) grpc.StreamServerInterceptor
- func MinVersionUnaryServerInterceptor(userAgentNames ...string) grpc.UnaryServerInterceptor
- type DeviceType
- type UserAgent
- type Version
Constants ¶
View Source
const ( UserAgentHeaderName = "user-agent" DefaultUserAgentName = "OpenCodeProtocol" )
Variables ¶
This section is empty.
Functions ¶
func InjectLoggingMetadata ¶
InjectLoggingMetadata injects client metadata into a zap logger
func MinVersionStreamServerInterceptor ¶
func MinVersionStreamServerInterceptor(userAgentNames ...string) grpc.StreamServerInterceptor
MinVersionStreamServerInterceptor prevents versions below the minimum version from accessing lower version APIs. The user agent is matched against each of the provided names in order.
func MinVersionUnaryServerInterceptor ¶
func MinVersionUnaryServerInterceptor(userAgentNames ...string) grpc.UnaryServerInterceptor
MinVersionUnaryServerInterceptor prevents versions below the minimum version from accessing outdated APIs. The user agent is matched against each of the provided names in order.
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 {
Name string
DeviceType DeviceType
Version Version
}
func GetUserAgent ¶
GetUserAgent gets the client user agent value from headers in the provided context
func GetUserAgentByNames ¶ added in v1.27.0
GetUserAgentByNames gets the client user agent value from headers in the provided context, trying each name in order and returning the first match.
Click to show internal directories.
Click to hide internal directories.