psi

package
v2.0.15+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExportExchangePayload

func ExportExchangePayload() string

ExportExchangePayload creates a payload for client-to-client server connection info exchange.

ExportExchangePayload will succeed only when Psiphon is running, between Start and Stop.

The return value is a payload that may be exchanged with another client; when "", the export failed and a diagnostic has been logged.

func GetBuildInfo added in v1.0.5

func GetBuildInfo() string

Get build info from tunnel-core

func GetPacketTunnelDNSResolverIPv4Address added in v1.0.5

func GetPacketTunnelDNSResolverIPv4Address() string

func GetPacketTunnelDNSResolverIPv6Address added in v1.0.5

func GetPacketTunnelDNSResolverIPv6Address() string

func GetPacketTunnelMTU added in v1.0.5

func GetPacketTunnelMTU() int

func HomepageFilePath

func HomepageFilePath(rootDataDirectoryPath string) string

HomepageFilePath returns the path where homepage files will be paved.

rootDataDirectoryPath is the configured data root directory.

Note: homepage files will only be paved if UseNoticeFiles is set in the config passed to Start().

func ImportExchangePayload

func ImportExchangePayload(payload string) bool

ImportExchangePayload imports a payload generated by ExportExchangePayload.

If an import occurs when Psiphon is working to establsh a tunnel, the newly imported server entry is prioritized.

The return value indicates a successful import. If the import failed, a a diagnostic notice has been logged.

func NoticeUserLog added in v1.0.5

func NoticeUserLog(message string)

func NoticesFilePath

func NoticesFilePath(rootDataDirectoryPath string) string

NoticesFilePath returns the path where the notices file will be paved.

rootDataDirectoryPath is the configured data root directory.

Note: notices will only be paved if UseNoticeFiles is set in the config passed to Start().

func OldNoticesFilePath

func OldNoticesFilePath(rootDataDirectoryPath string) string

OldNoticesFilePath returns the path where the notices file is moved to when file rotation occurs.

rootDataDirectoryPath is the configured data root directory.

Note: notices will only be paved if UseNoticeFiles is set in the config passed to Start().

func ReconnectTunnel added in v1.0.5

func ReconnectTunnel()

ReconnectTunnel initiates a reconnect of the current tunnel, if one is running.

func SetDynamicConfig added in v1.0.5

func SetDynamicConfig(newSponsorID, newAuthorizationsList string)

SetDynamicConfig overrides the sponsor ID and authorizations fields set in the config passed to Start. SetDynamicConfig has no effect if no Controller is started.

The input newAuthorizationsList is a space-delimited list of base64 authorizations. This is a workaround for gobind type limitations.

func Start

func Start(
	configJson,
	embeddedServerEntryList,
	embeddedServerEntryListFilename string,
	provider PsiphonProvider,
	useDeviceBinder,
	useIPv6Synthesizer bool) error

func StartSendFeedback

func StartSendFeedback(
	configJson,
	diagnosticsJson,
	uploadPath string,
	feedbackHandler PsiphonProviderFeedbackHandler,
	networkInfoProvider PsiphonProviderNetwork,
	noticeHandler PsiphonProviderNoticeHandler,
	useIPv6Synthesizer bool) error

StartSendFeedback encrypts the provided diagnostics and then attempts to upload the encrypted diagnostics to one of the feedback upload locations supplied by the provided config or tactics.

Returns immediately after starting the operation in a goroutine. The operation has completed when SendFeedbackCompleted(error) is called on the provided PsiphonProviderFeedbackHandler; if error is non-nil, then the operation failed.

Only one active upload is supported at a time. An ongoing upload will be cancelled if this function is called again before it completes.

Warnings:

  • Should not be used with Start concurrently in the same process
  • An ongoing feedback upload started with StartSendFeedback should be stopped with StopSendFeedback before the process exists. This ensures that any underlying resources are cleaned up; failing to do so may result in data store corruption or other undefined behavior.
  • Start and StartSendFeedback both make an attempt to migrate persistent files from legacy locations in a one-time operation. If these functions are called in parallel, then there is a chance that the migration attempts could execute at the same time and result in non-fatal errors in one, or both, of the migration operations.
  • Calling StartSendFeedback or StopSendFeedback on the same call stack that the PsiphonProviderFeedbackHandler.SendFeedbackCompleted() callback is delivered on can cause a deadlock. I.E. the callback code must return so the wait group can complete and the lock acquired in StopSendFeedback can be released.

func Stop

func Stop()

func StopSendFeedback

func StopSendFeedback()

StopSendFeedback interrupts an in-progress feedback upload operation started with `StartSendFeedback`.

Warning: should not be used with Start concurrently in the same process.

func UpgradeDownloadFilePath

func UpgradeDownloadFilePath(rootDataDirectoryPath string) string

UpgradeDownloadFilePath returns the path where the downloaded upgrade file will be paved.

rootDataDirectoryPath is the configured data root directory.

Note: upgrades will only be paved if UpgradeDownloadURLs is set in the config passed to Start() and there are upgrades available.

func WriteRuntimeProfiles added in v1.0.10

func WriteRuntimeProfiles(outputDirectory string, cpuSampleDurationSeconds, blockSampleDurationSeconds int)

WriteRuntimeProfiles writes Go runtime profile information to a set of files in the specified output directory. See common.WriteRuntimeProfiles for more details.

If called before Start, log notices will emit to stderr.

Types

type PsiphonProvider

type PsiphonProvider interface {
	PsiphonProviderNoticeHandler
	PsiphonProviderNetwork
	BindToDevice(fileDescriptor int) (string, error)
	GetPrimaryDnsServer() string
	GetSecondaryDnsServer() string
}

type PsiphonProviderFeedbackHandler

type PsiphonProviderFeedbackHandler interface {
	SendFeedbackCompleted(err error)
}

type PsiphonProviderNetwork

type PsiphonProviderNetwork interface {
	HasNetworkConnectivity() int
	GetNetworkID() string
	IPv6Synthesize(IPv4Addr string) string
}

type PsiphonProviderNoticeHandler

type PsiphonProviderNoticeHandler interface {
	Notice(noticeJSON string)
}

Jump to

Keyboard shortcuts

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