riskcontrol

package
v1.0.77 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package deviceinfo collects the platform hardware product model and the platform values used by device-related risk-control headers.

Index

Constants

View Source
const (
	OSTypeUnknown = "0"
	OSTypeWindows = "1"
	OSTypeLinux   = "2"
	OSTypeMacOS   = "3"
)

OS type enum values for X-Agent-Os-Type.

View Source
const (
	// TerminalTypePC is the fixed X-Agent-Terminal-Type value for the CLI.
	TerminalTypePC = "1"

	// Unknown is used when the hardware product model cannot be collected.
	Unknown = "Unknown"
)
View Source
const (
	HeaderProductModel = "X-Agent-Device-Type"
	HeaderOSType       = "X-Agent-Os-Type"
)

Variables

This section is empty.

Functions

func OSName

func OSName() string

OSName returns the platform name used by GetOSType.

Types

type HostSource

type HostSource struct {
	// contains filtered or unexported fields
}

HostSource lazily reads host signals once, after outbound policy authorizes the first request. Failed probes are cached and are not retried per request.

func NewHostSource

func NewHostSource() *HostSource

NewHostSource creates the production host signal source.

func (*HostSource) Snapshot

func (s *HostSource) Snapshot() Snapshot

Snapshot returns the cached host signal snapshot.

type OSType

type OSType string

OSType is the server-side risk-control operating-system enum.

func GetOSType

func GetOSType(osName string) OSType

GetOSType maps a platform name to the X-Agent-Os-Type enum.

type Snapshot

type Snapshot struct {
	OSType       OSType
	ProductModel string
}

Snapshot contains the deliberately small risk-control signal set. ProductModel is omitted when the platform cannot provide a safe value.

type Source

type Source interface {
	Snapshot() Snapshot
}

Source supplies one immutable process-level snapshot.

type Transport

type Transport struct {
	// contains filtered or unexported fields
}

Transport is the feature's final outbound boundary. It removes caller- or extension-supplied signal headers first and writes trusted values only after authorizing an official SDK origin and authentication state.

func NewTransport

func NewTransport(next http.RoundTripper, source Source) *Transport

NewTransport creates the final SDK outbound policy boundary. A nil source disables collection and injection while preserving restricted-header stripping for opt-out and extension-credential requests.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper.

Jump to

Keyboard shortcuts

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