values

package
v2.0.13+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

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 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 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 {
	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(seed *prng.Seed) 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