seclient

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ANON_EMAIL_LOCALPART_BYTES       = 32
	ANON_PASSWORD_BYTES              = 20
	DEVICE_ID_BYTES                  = 20
	READ_LIMIT                 int64 = 128 * 1024
)
View Source
const (
	SE_STATUS_OK int64 = 0
)

Variables

View Source
var DefaultSEEndpoints = SEEndpoints{
	RegisterSubscriber:     "https://api.sec-tunnel.com/v4/register_subscriber",
	SubscriberLogin:        "https://api.sec-tunnel.com/v4/subscriber_login",
	RegisterDevice:         "https://api.sec-tunnel.com/v4/register_device",
	DeviceGeneratePassword: "https://api.sec-tunnel.com/v4/device_generate_password",
	GeoList:                "https://api.sec-tunnel.com/v4/geo_list",
	Discover:               "https://api.sec-tunnel.com/v4/discover",
}
View Source
var DefaultSESettings = SESettings{
	ClientVersion:   "Stable 74.0.3911.232",
	ClientType:      "se0316",
	UserAgent:       "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.192 Safari/537.36 OPR/74.0.3911.232",
	DeviceName:      "Opera-Browser-Client",
	OperatingSystem: "Windows",
	Endpoints:       DefaultSEEndpoints,
}
View Source
var RandomSource secureRandomSource

Functions

This section is empty.

Types

type SEClient

type SEClient struct {
	Settings             SESettings
	SubscriberEmail      string
	SubscriberPassword   string
	DeviceID             string
	AssignedDeviceID     string
	AssignedDeviceIDHash string
	DevicePassword       string
	Mux                  sync.Mutex
	// contains filtered or unexported fields
}

func NewSEClient

func NewSEClient(apiUsername, apiSecret string, transport http.RoundTripper) (*SEClient, error)

Instantiates SurfEasy client with default settings and given API keys. Optional `transport` parameter allows to override HTTP transport used for HTTP calls

func (*SEClient) AnonRegister

func (c *SEClient) AnonRegister(ctx context.Context) error

func (*SEClient) DeviceGeneratePassword added in v1.2.0

func (c *SEClient) DeviceGeneratePassword(ctx context.Context) error

func (*SEClient) Discover

func (c *SEClient) Discover(ctx context.Context, requestedGeo string) ([]SEIPEntry, error)

func (*SEClient) GeoList

func (c *SEClient) GeoList(ctx context.Context) ([]SEGeoEntry, error)

func (*SEClient) GetProxyCredentials

func (c *SEClient) GetProxyCredentials() (string, string)

func (*SEClient) Login added in v1.2.0

func (c *SEClient) Login(ctx context.Context) error

func (*SEClient) Register

func (c *SEClient) Register(ctx context.Context) error

func (*SEClient) RegisterDevice

func (c *SEClient) RegisterDevice(ctx context.Context) error

func (*SEClient) ResetCookies added in v1.2.0

func (c *SEClient) ResetCookies() error

func (*SEClient) RpcCall added in v1.2.0

func (c *SEClient) RpcCall(ctx context.Context, endpoint string, params map[string]string, res interface{}) error

type SEDeviceGeneratePasswordData added in v1.2.0

type SEDeviceGeneratePasswordData struct {
	DevicePassword string `json:"device_password"`
}

type SEDeviceGeneratePasswordResponse added in v1.2.0

type SEDeviceGeneratePasswordResponse struct {
	Data   SEDeviceGeneratePasswordData `json:"data"`
	Status SEStatusPair                 `json:"return_code"`
}

type SEDiscoverResponse

type SEDiscoverResponse struct {
	Data struct {
		IPs []SEIPEntry `json:"ips"`
	} `json:"data"`
	Status SEStatusPair `json:"return_code"`
}

type SEEndpoints

type SEEndpoints struct {
	RegisterSubscriber     string
	SubscriberLogin        string
	RegisterDevice         string
	DeviceGeneratePassword string
	GeoList                string
	Discover               string
}

type SEGeoEntry

type SEGeoEntry struct {
	Country     string `json:"country,omitempty"`
	CountryCode string `json:"country_code"`
}

type SEGeoListResponse

type SEGeoListResponse struct {
	Data struct {
		Geos []SEGeoEntry `json:"geos"`
	} `json:"data"`
	Status SEStatusPair `json:"return_code"`
}

type SEIPEntry

type SEIPEntry struct {
	Geo   SEGeoEntry `json:"geo"`
	IP    string     `json:"ip"`
	Ports []uint16   `json:"ports"`
}

func (*SEIPEntry) NetAddr

func (e *SEIPEntry) NetAddr() string

type SERegisterDeviceData

type SERegisterDeviceData struct {
	ClientType     string `json:"client_type"`
	DeviceID       string `json:"device_id"`
	DevicePassword string `json:"device_password"`
}

type SERegisterDeviceResponse

type SERegisterDeviceResponse struct {
	Data   SERegisterDeviceData `json:"data"`
	Status SEStatusPair         `json:"return_code"`
}

type SERegisterSubscriberResponse

type SERegisterSubscriberResponse struct {
	Data   interface{}  `json:"data"`
	Status SEStatusPair `json:"return_code"`
}

type SESettings

type SESettings struct {
	ClientVersion   string
	ClientType      string
	DeviceName      string
	OperatingSystem string
	UserAgent       string
	Endpoints       SEEndpoints
}

type SEStatusPair

type SEStatusPair struct {
	Code    int64
	Message string
}

func (*SEStatusPair) UnmarshalJSON

func (p *SEStatusPair) UnmarshalJSON(b []byte) error

type SESubscriberLoginResponse added in v1.2.0

type SESubscriberLoginResponse SERegisterSubscriberResponse

type StdJar added in v1.2.0

type StdJar struct {
	// contains filtered or unexported fields
}

func NewStdJar added in v1.2.0

func NewStdJar() (*StdJar, error)

func (*StdJar) Cookies added in v1.2.0

func (j *StdJar) Cookies(u *url.URL) []*http.Cookie

func (*StdJar) Reset added in v1.2.0

func (j *StdJar) Reset() error

func (*StdJar) SetCookies added in v1.2.0

func (j *StdJar) SetCookies(u *url.URL, cookies []*http.Cookie)

type StrKV added in v1.2.0

type StrKV map[string]string

Jump to

Keyboard shortcuts

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