riskcontrol

package
v1.0.94 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2026 License: MIT Imports: 10 Imported by: 0 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

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"
	HeaderCredentialSource = "X-Agent-Credential-Source"
)

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 when workspace policy enables risk control and the request targets an official SDK origin.

func NewTransport

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

NewTransport creates the final SDK outbound policy boundary. A nil source means workspace policy disabled risk control, so all signal injection, including credential source, is disabled. Restricted headers are still stripped from caller- and extension-supplied requests.

func (*Transport) BaseRoundTripper added in v1.0.82

func (t *Transport) BaseRoundTripper() http.RoundTripper

BaseRoundTripper exposes the network transport so policy routers can clone and rebuild the complete decorator graph without dropping risk control.

func (*Transport) RoundTrip

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

RoundTrip implements http.RoundTripper.

func (*Transport) WithBaseRoundTripper added in v1.0.82

func (t *Transport) WithBaseRoundTripper(base http.RoundTripper) http.RoundTripper

WithBaseRoundTripper returns an equivalent risk-control boundary over base.

Jump to

Keyboard shortcuts

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