values

package
v2.0.28+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2022 License: GPL-3.0 Imports: 11 Imported by: 32

Documentation

Overview

Package values provides a mechanism for specifying and selecting dynamic values employed by the Psiphon client and server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetContentType

func GetContentType(PRNG *prng.PRNG) string

GetContentType selects a value based on the previously set spec, or returns a default when no spec is set.

func GetCookieName

func GetCookieName(PRNG *prng.PRNG) string

GetCookieName selects a value based on the previously set spec, or returns a default when no spec is set.

func GetHostName

func GetHostName() string

GetHostName selects a value based on the previously set spec, or returns a default when no spec is set.

func GetRevision

func GetRevision() string

GetRevision gets the previously set revision.

func GetSSHClientVersion

func GetSSHClientVersion() string

GetSSHClientVersion selects a value based on the previously set spec, or returns a default when no spec is set.

func GetSSHServerVersion

func GetSSHServerVersion(seed *prng.Seed) string

GetSSHServerVersion selects a value based on the previously set spec, or returns a default when no spec is set.

func GetUserAgent

func GetUserAgent() string

GetUserAgent selects a value based on the previously set spec, or returns a default when no spec is set.

func SetContentTypesSpec

func SetContentTypesSpec(spec *ValueSpec)

SetContentTypesSpec sets the corresponding value spec.

func SetCookieNamesSpec

func SetCookieNamesSpec(spec *ValueSpec)

SetCookieNamesSpec sets the corresponding value spec.

func SetHostNamesSpec

func SetHostNamesSpec(spec *ValueSpec)

SetHostNamesSpec sets the corresponding value spec.

func SetRevision

func SetRevision(rev string)

SetRevision set the revision value, which may be used to track which value specs are active. The revision is not managed by this package and must be set by the package user.

func SetSSHClientVersionsSpec

func SetSSHClientVersionsSpec(spec *ValueSpec)

SetSSHClientVersionsSpec sets the corresponding value spec.

func SetSSHServerVersionsSpec

func SetSSHServerVersionsSpec(spec *ValueSpec)

SetSSHServerVersionsSpec sets the corresponding value spec.

func SetUserAgentsSpec

func SetUserAgentsSpec(spec *ValueSpec)

SetUserAgentsSpec sets the corresponding value spec.

Types

type PartSpec

type PartSpec struct {
	Items              []string
	MinCount, MaxCount int
}

type ValueSpec

type ValueSpec struct {
	Probability float64
	Parts       []PartSpec
	Padding     []byte
}

ValueSpec specifies a value selection space.

func DeobfuscateValueSpec

func DeobfuscateValueSpec(obfuscatedValueSpec, obfuscationKey []byte) *ValueSpec

DeobfuscateValueSpec reconstitutes an obfuscated spec.

func NewPickOneSpec

func NewPickOneSpec(items []string) *ValueSpec

NewPickOneSpec creates a simple spec to select one item from a list as a value.

func (*ValueSpec) GetValue

func (spec *ValueSpec) GetValue(PRNG *prng.PRNG) string

GetValue selects a value according to the spec. An optional seed may be specified to support replay.

func (*ValueSpec) Obfuscate

func (spec *ValueSpec) Obfuscate(
	obfuscationKey []byte,
	minPadding, maxPadding int) ([]byte, error)

Obfuscate creates an obfuscated blob from a spec.

Jump to

Keyboard shortcuts

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