Documentation ¶
Index ¶
- Constants
- Variables
- func DeriveSSHServerKEXPRNGSeed(obfuscatedKey string) (*prng.Seed, error)
- func DeriveSSHServerVersionPRNGSeed(obfuscatedKey string) (*prng.Seed, error)
- func EncodeServerEntry(serverEntry *ServerEntry) (string, error)
- func GenerateServerEntryTag(ipAddress, webServerSecret string) string
- func GetCapability(protocol string) string
- func GetTacticsCapability(protocol string) string
- func QUICVersionIsObfuscated(version string) bool
- func TLSProfileIsRandomized(tlsProfile string) bool
- func TunnelProtocolIsResourceIntensive(protocol string) bool
- func TunnelProtocolUsesFrontedMeek(protocol string) bool
- func TunnelProtocolUsesFrontedMeekQUIC(protocol string) bool
- func TunnelProtocolUsesMarionette(protocol string) bool
- func TunnelProtocolUsesMeek(protocol string) bool
- func TunnelProtocolUsesMeekHTTP(protocol string) bool
- func TunnelProtocolUsesMeekHTTPS(protocol string) bool
- func TunnelProtocolUsesObfuscatedSSH(protocol string) bool
- func TunnelProtocolUsesObfuscatedSessionTickets(protocol string) bool
- func TunnelProtocolUsesQUIC(protocol string) bool
- func TunnelProtocolUsesSSH(protocol string) bool
- func TunnelProtocolUsesTapdance(protocol string) bool
- func UseClientTunnelProtocol(clientProtocol string, serverProtocols TunnelProtocols) bool
- func ValidateServerEntryFields(serverEntryFields ServerEntryFields) error
- type ConnectedResponse
- type HandshakeResponse
- type MeekCookieData
- type OSLRequest
- type QUICVersions
- type RandomStreamRequest
- type SSHPasswordPayload
- type ServerEntry
- func (serverEntry *ServerEntry) GetSupportedProtocols(useUpstreamProxy bool, limitTunnelProtocols []string, excludeIntensive bool) []string
- func (serverEntry *ServerEntry) GetSupportedTacticsProtocols() []string
- func (serverEntry *ServerEntry) GetUntunneledWebRequestPorts() []string
- func (serverEntry *ServerEntry) SupportsProtocol(protocol string) bool
- func (serverEntry *ServerEntry) SupportsSSHAPIRequests() bool
- type ServerEntryFields
- func (fields ServerEntryFields) GetConfigurationVersion() int
- func (fields ServerEntryFields) GetIPAddress() string
- func (fields ServerEntryFields) GetLocalSource() string
- func (fields ServerEntryFields) GetTag() string
- func (fields ServerEntryFields) GetWebServerSecret() string
- func (fields ServerEntryFields) SetLocalSource(source string)
- func (fields ServerEntryFields) SetLocalTimestamp(timestamp string)
- func (fields ServerEntryFields) SetTag(tag string)
- type StatusResponse
- type StreamingServerEntryDecoder
- type TLSProfiles
- type TunnelProtocols
Constants ¶
const ( TUNNEL_PROTOCOL_SSH = "SSH" TUNNEL_PROTOCOL_OBFUSCATED_SSH = "OSSH" TUNNEL_PROTOCOL_UNFRONTED_MEEK = "UNFRONTED-MEEK-OSSH" TUNNEL_PROTOCOL_UNFRONTED_MEEK_HTTPS = "UNFRONTED-MEEK-HTTPS-OSSH" TUNNEL_PROTOCOL_UNFRONTED_MEEK_SESSION_TICKET = "UNFRONTED-MEEK-SESSION-TICKET-OSSH" TUNNEL_PROTOCOL_FRONTED_MEEK = "FRONTED-MEEK-OSSH" TUNNEL_PROTOCOL_FRONTED_MEEK_HTTP = "FRONTED-MEEK-HTTP-OSSH" TUNNEL_PROTOCOL_QUIC_OBFUSCATED_SSH = "QUIC-OSSH" TUNNEL_PROTOCOL_FRONTED_MEEK_QUIC_OBFUSCATED_SSH = "FRONTED-MEEK-QUIC-OSSH" TUNNEL_PROTOCOL_MARIONETTE_OBFUSCATED_SSH = "MARIONETTE-OSSH" TUNNEL_PROTOCOL_TAPDANCE_OBFUSCATED_SSH = "TAPDANCE-OSSH" SERVER_ENTRY_SOURCE_EMBEDDED = "EMBEDDED" SERVER_ENTRY_SOURCE_REMOTE = "REMOTE" SERVER_ENTRY_SOURCE_DISCOVERY = "DISCOVERY" SERVER_ENTRY_SOURCE_TARGET = "TARGET" SERVER_ENTRY_SOURCE_OBFUSCATED = "OBFUSCATED" CAPABILITY_SSH_API_REQUESTS = "ssh-api-requests" CAPABILITY_UNTUNNELED_WEB_API_REQUESTS = "handshake" CLIENT_CAPABILITY_SERVER_REQUESTS = "server-requests" PSIPHON_API_HANDSHAKE_REQUEST_NAME = "psiphon-handshake" PSIPHON_API_CONNECTED_REQUEST_NAME = "psiphon-connected" PSIPHON_API_STATUS_REQUEST_NAME = "psiphon-status" PSIPHON_API_OSL_REQUEST_NAME = "psiphon-osl" // PSIPHON_API_CLIENT_VERIFICATION_REQUEST_NAME may still be used by older Android clients PSIPHON_API_CLIENT_VERIFICATION_REQUEST_NAME = "psiphon-client-verification" PSIPHON_API_CLIENT_SESSION_ID_LENGTH = 16 PSIPHON_SSH_API_PROTOCOL = "ssh" PSIPHON_WEB_API_PROTOCOL = "web" PACKET_TUNNEL_CHANNEL_TYPE = "tun@psiphon.ca" RANDOM_STREAM_CHANNEL_TYPE = "random@psiphon.ca" PSIPHON_API_HANDSHAKE_AUTHORIZATIONS = "authorizations" )
const ( TLS_VERSION_12 = "TLSv1.2" TLS_VERSION_13 = "TLSv1.3" TLS_PROFILE_IOS_111 = "iOS-11.1" TLS_PROFILE_IOS_121 = "iOS-12.1" TLS_PROFILE_CHROME_58 = "Chrome-58" TLS_PROFILE_CHROME_62 = "Chrome-62" TLS_PROFILE_CHROME_70 = "Chrome-70" TLS_PROFILE_CHROME_72 = "Chrome-72" TLS_PROFILE_FIREFOX_55 = "Firefox-55" TLS_PROFILE_FIREFOX_56 = "Firefox-56" TLS_PROFILE_FIREFOX_65 = "Firefox-65" TLS_PROFILE_RANDOMIZED = "Randomized-v2" )
const ( QUIC_VERSION_GQUIC39 = "gQUICv39" QUIC_VERSION_GQUIC43 = "gQUICv43" QUIC_VERSION_GQUIC44 = "gQUICv44" QUIC_VERSION_OBFUSCATED = "OBFUSCATED" )
Variables ¶
var DefaultDisabledTunnelProtocols = TunnelProtocols{ TUNNEL_PROTOCOL_MARIONETTE_OBFUSCATED_SSH, TUNNEL_PROTOCOL_TAPDANCE_OBFUSCATED_SSH, TUNNEL_PROTOCOL_FRONTED_MEEK_QUIC_OBFUSCATED_SSH, }
var SupportedQUICVersions = QUICVersions{ QUIC_VERSION_GQUIC39, QUIC_VERSION_GQUIC43, QUIC_VERSION_GQUIC44, QUIC_VERSION_OBFUSCATED, }
var SupportedServerEntrySources = TunnelProtocols{ SERVER_ENTRY_SOURCE_EMBEDDED, SERVER_ENTRY_SOURCE_REMOTE, SERVER_ENTRY_SOURCE_DISCOVERY, SERVER_ENTRY_SOURCE_TARGET, SERVER_ENTRY_SOURCE_OBFUSCATED, }
var SupportedTLSProfiles = TLSProfiles{ TLS_PROFILE_IOS_111, TLS_PROFILE_IOS_121, TLS_PROFILE_CHROME_58, TLS_PROFILE_CHROME_62, TLS_PROFILE_CHROME_70, TLS_PROFILE_CHROME_72, TLS_PROFILE_FIREFOX_55, TLS_PROFILE_FIREFOX_56, TLS_PROFILE_FIREFOX_65, TLS_PROFILE_RANDOMIZED, }
var SupportedTunnelProtocols = TunnelProtocols{ TUNNEL_PROTOCOL_SSH, TUNNEL_PROTOCOL_OBFUSCATED_SSH, TUNNEL_PROTOCOL_UNFRONTED_MEEK, TUNNEL_PROTOCOL_UNFRONTED_MEEK_HTTPS, TUNNEL_PROTOCOL_UNFRONTED_MEEK_SESSION_TICKET, TUNNEL_PROTOCOL_FRONTED_MEEK, TUNNEL_PROTOCOL_FRONTED_MEEK_HTTP, TUNNEL_PROTOCOL_QUIC_OBFUSCATED_SSH, TUNNEL_PROTOCOL_FRONTED_MEEK_QUIC_OBFUSCATED_SSH, TUNNEL_PROTOCOL_MARIONETTE_OBFUSCATED_SSH, TUNNEL_PROTOCOL_TAPDANCE_OBFUSCATED_SSH, }
Functions ¶
func EncodeServerEntry ¶
func EncodeServerEntry(serverEntry *ServerEntry) (string, error)
EncodeServerEntry returns a string containing the encoding of a ServerEntry following Psiphon conventions.
func GenerateServerEntryTag ¶
GenerateServerEntryTag creates a server entry tag value that is cryptographically derived from the IP address and web server secret in a way that is difficult to reverse the IP address value from the tag or compute the tag without having the web server secret, a 256-bit random value which is unique per server, in addition to the IP address. A database consisting only of server entry tags should be resistent to an attack that attempts to reverse all the server IPs, even given a small IP space (IPv4), or some subset of the web server secrets.
func GetCapability ¶
GetCapability returns the server capability corresponding to the tunnel protocol.
func GetTacticsCapability ¶ added in v1.0.5
GetTacticsCapability returns the server tactics capability corresponding to the tunnel protocol.
func QUICVersionIsObfuscated ¶ added in v1.0.10
func TLSProfileIsRandomized ¶ added in v1.0.10
func TunnelProtocolIsResourceIntensive ¶ added in v1.0.7
func TunnelProtocolUsesFrontedMeek ¶ added in v1.0.10
func TunnelProtocolUsesMarionette ¶ added in v1.0.9
func TunnelProtocolUsesMeek ¶ added in v1.0.5
func TunnelProtocolUsesQUIC ¶ added in v1.0.7
func TunnelProtocolUsesSSH ¶
func TunnelProtocolUsesTapdance ¶ added in v1.0.9
func UseClientTunnelProtocol ¶
func UseClientTunnelProtocol( clientProtocol string, serverProtocols TunnelProtocols) bool
func ValidateServerEntryFields ¶ added in v1.0.7
func ValidateServerEntryFields(serverEntryFields ServerEntryFields) error
ValidateServerEntryFields checks for malformed server entries. Currently, it checks for a valid ipAddress. This is important since the IP address is the key used to store/lookup the server entry. TODO: validate more fields?
Types ¶
type ConnectedResponse ¶
type HandshakeResponse ¶
type HandshakeResponse struct { SSHSessionID string `json:"ssh_session_id"` Homepages []string `json:"homepages"` UpgradeClientVersion string `json:"upgrade_client_version"` PageViewRegexes []map[string]string `json:"page_view_regexes"` HttpsRequestRegexes []map[string]string `json:"https_request_regexes"` EncodedServerList []string `json:"encoded_server_list"` ClientRegion string `json:"client_region"` ServerTimestamp string `json:"server_timestamp"` ActiveAuthorizationIDs []string `json:"active_authorization_ids"` TacticsPayload json.RawMessage `json:"tactics_payload"` Padding string `json:"padding"` }
type MeekCookieData ¶
type OSLRequest ¶
type OSLRequest struct { ClearLocalSLOKs bool `json:"clear_local_sloks"` SeedPayload *osl.SeedPayload `json:"seed_payload"` }
type QUICVersions ¶ added in v1.0.9
type QUICVersions []string
func (QUICVersions) PruneInvalid ¶ added in v1.0.9
func (versions QUICVersions) PruneInvalid() QUICVersions
func (QUICVersions) Validate ¶ added in v1.0.9
func (versions QUICVersions) Validate() error
type RandomStreamRequest ¶ added in v1.0.9
type SSHPasswordPayload ¶
type ServerEntry ¶
type ServerEntry struct { Tag string `json:"tag"` IpAddress string `json:"ipAddress"` WebServerPort string `json:"webServerPort"` // not an int WebServerSecret string `json:"webServerSecret"` WebServerCertificate string `json:"webServerCertificate"` SshPort int `json:"sshPort"` SshUsername string `json:"sshUsername"` SshPassword string `json:"sshPassword"` SshHostKey string `json:"sshHostKey"` SshObfuscatedPort int `json:"sshObfuscatedPort"` SshObfuscatedQUICPort int `json:"sshObfuscatedQUICPort"` SshObfuscatedTapdancePort int `json:"sshObfuscatedTapdancePort"` SshObfuscatedKey string `json:"sshObfuscatedKey"` Capabilities []string `json:"capabilities"` Region string `json:"region"` MeekServerPort int `json:"meekServerPort"` MeekCookieEncryptionPublicKey string `json:"meekCookieEncryptionPublicKey"` MeekObfuscatedKey string `json:"meekObfuscatedKey"` MeekFrontingHost string `json:"meekFrontingHost"` MeekFrontingHosts []string `json:"meekFrontingHosts"` MeekFrontingDomain string `json:"meekFrontingDomain"` MeekFrontingAddresses []string `json:"meekFrontingAddresses"` MeekFrontingAddressesRegex string `json:"meekFrontingAddressesRegex"` MeekFrontingDisableSNI bool `json:"meekFrontingDisableSNI"` TacticsRequestPublicKey string `json:"tacticsRequestPublicKey"` TacticsRequestObfuscatedKey string `json:"tacticsRequestObfuscatedKey"` MarionetteFormat string `json:"marionetteFormat"` ConfigurationVersion int `json:"configurationVersion"` // These local fields are not expected to be present in downloaded server // entries. They are added by the client to record and report stats about // how and when server entries are obtained. LocalSource string `json:"localSource"` LocalTimestamp string `json:"localTimestamp"` }
ServerEntry represents a Psiphon server. It contains information about how to establish a tunnel connection to the server through several protocols. Server entries are JSON records downloaded from various sources.
func DecodeServerEntry ¶
func DecodeServerEntry( encodedServerEntry, timestamp, serverEntrySource string) (*ServerEntry, error)
DecodeServerEntry extracts a server entry from the encoding used by remote server lists and Psiphon server handshake requests.
The resulting ServerEntry.LocalSource is populated with serverEntrySource, which should be one of SERVER_ENTRY_SOURCE_EMBEDDED, SERVER_ENTRY_SOURCE_REMOTE, SERVER_ENTRY_SOURCE_DISCOVERY, SERVER_ENTRY_SOURCE_TARGET, SERVER_ENTRY_SOURCE_OBFUSCATED. ServerEntry.LocalTimestamp is populated with the provided timestamp, which should be a RFC 3339 formatted string. These local fields are stored with the server entry and reported to the server as stats (a coarse granularity timestamp is reported).
func (*ServerEntry) GetSupportedProtocols ¶
func (serverEntry *ServerEntry) GetSupportedProtocols( useUpstreamProxy bool, limitTunnelProtocols []string, excludeIntensive bool) []string
GetSupportedProtocols returns a list of tunnel protocols supported by the ServerEntry's capabilities.
func (*ServerEntry) GetSupportedTacticsProtocols ¶ added in v1.0.5
func (serverEntry *ServerEntry) GetSupportedTacticsProtocols() []string
GetSupportedTacticsProtocols returns a list of tunnel protocols, supported by the ServerEntry's capabilities, that may be used for tactics requests.
func (*ServerEntry) GetUntunneledWebRequestPorts ¶
func (serverEntry *ServerEntry) GetUntunneledWebRequestPorts() []string
func (*ServerEntry) SupportsProtocol ¶
func (serverEntry *ServerEntry) SupportsProtocol(protocol string) bool
SupportsProtocol returns true if and only if the ServerEntry has the necessary capability to support the specified tunnel protocol.
func (*ServerEntry) SupportsSSHAPIRequests ¶
func (serverEntry *ServerEntry) SupportsSSHAPIRequests() bool
SupportsSSHAPIRequests returns true when the server supports SSH API requests.
type ServerEntryFields ¶ added in v1.0.7
type ServerEntryFields map[string]interface{}
ServerEntryFields is an alternate representation of ServerEntry which enables future compatibility when unmarshaling and persisting new server entries which may contain new, unrecognized fields not in the ServerEntry type for a particular client version.
When new JSON server entries with new fields are unmarshaled to ServerEntry types, unrecognized fields are discarded. When unmarshaled to ServerEntryFields, unrecognized fields are retained and may be persisted and available when the client is upgraded and unmarshals to an updated ServerEntry type.
func DecodeServerEntryFields ¶ added in v1.0.7
func DecodeServerEntryFields( encodedServerEntry, timestamp, serverEntrySource string) (ServerEntryFields, error)
DecodeServerEntryFields extracts an encoded server entry into a ServerEntryFields type, much like DecodeServerEntry. Unrecognized fields not in ServerEntry are retained in the ServerEntryFields.
func DecodeServerEntryList ¶ added in v1.0.5
func DecodeServerEntryList( encodedServerEntryList, timestamp, serverEntrySource string) ([]ServerEntryFields, error)
DecodeServerEntryList extracts server entries from the list encoding used by remote server lists and Psiphon server handshake requests. Each server entry is validated and invalid entries are skipped. See DecodeServerEntry for note on serverEntrySource/timestamp.
func (ServerEntryFields) GetConfigurationVersion ¶ added in v1.0.7
func (fields ServerEntryFields) GetConfigurationVersion() int
func (ServerEntryFields) GetIPAddress ¶ added in v1.0.7
func (fields ServerEntryFields) GetIPAddress() string
func (ServerEntryFields) GetLocalSource ¶
func (fields ServerEntryFields) GetLocalSource() string
func (ServerEntryFields) GetTag ¶
func (fields ServerEntryFields) GetTag() string
func (ServerEntryFields) GetWebServerSecret ¶
func (fields ServerEntryFields) GetWebServerSecret() string
func (ServerEntryFields) SetLocalSource ¶ added in v1.0.7
func (fields ServerEntryFields) SetLocalSource(source string)
func (ServerEntryFields) SetLocalTimestamp ¶ added in v1.0.7
func (fields ServerEntryFields) SetLocalTimestamp(timestamp string)
func (ServerEntryFields) SetTag ¶
func (fields ServerEntryFields) SetTag(tag string)
type StatusResponse ¶
type StreamingServerEntryDecoder ¶ added in v1.0.5
type StreamingServerEntryDecoder struct {
// contains filtered or unexported fields
}
StreamingServerEntryDecoder performs the DecodeServerEntryList operation, loading only one server entry into memory at a time.
func NewStreamingServerEntryDecoder ¶ added in v1.0.5
func NewStreamingServerEntryDecoder( encodedServerEntryListReader io.Reader, timestamp, serverEntrySource string) *StreamingServerEntryDecoder
NewStreamingServerEntryDecoder creates a new StreamingServerEntryDecoder.
func (*StreamingServerEntryDecoder) Next ¶ added in v1.0.5
func (decoder *StreamingServerEntryDecoder) Next() (ServerEntryFields, error)
Next reads and decodes, and validates the next server entry from the input stream, returning a nil server entry when the stream is complete.
Limitations:
- Each encoded server entry line cannot exceed bufio.MaxScanTokenSize, the default buffer size which this decoder uses. This is 64K.
- DecodeServerEntry is called on each encoded server entry line, which will allocate memory to hex decode and JSON deserialze the server entry. As this is not presently reusing a fixed buffer, each call will allocate additional memory; garbage collection is necessary to reclaim that memory for reuse for the next server entry.
type TLSProfiles ¶ added in v1.0.5
type TLSProfiles []string
func (TLSProfiles) PruneInvalid ¶ added in v1.0.7
func (profiles TLSProfiles) PruneInvalid() TLSProfiles
func (TLSProfiles) Validate ¶ added in v1.0.5
func (profiles TLSProfiles) Validate() error
type TunnelProtocols ¶ added in v1.0.5
type TunnelProtocols []string
func (TunnelProtocols) PruneInvalid ¶ added in v1.0.7
func (t TunnelProtocols) PruneInvalid() TunnelProtocols
func (TunnelProtocols) Validate ¶ added in v1.0.5
func (t TunnelProtocols) Validate() error