client

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2020 License: MIT Imports: 11 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockedHostnames = map[string]struct{}{
	"www.pixiv.net": {},
}

BlockedHostnames constains hosts that blocked by sni detect.

View Source
var Default = &Client{}

Default client auto login with PIXIV_PHPSESSID env var.

View Source
var Hosts = map[string]string{}

Hosts cache

Functions

func ParseAPIResult added in v0.2.0

func ParseAPIResult(r io.Reader) (ret gjson.Result, err error)

ParseAPIResult parses error from json api response, and returns body part.

Types

type BypassSNIBlockingTransport added in v0.3.2

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

BypassSNIBlockingTransport bypass sni bloking when host in BlockedHostnames

func (BypassSNIBlockingTransport) RoundTrip added in v0.3.2

func (t BypassSNIBlockingTransport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip implements http.RoundTripper

type Client added in v0.2.0

type Client struct {
	ServerURL string
	http.Client
}

Client to send request to pixiv server.

func (*Client) BypassSNIBlocking added in v0.3.2

func (c *Client) BypassSNIBlocking()

BypassSNIBlocking wrap current transport with bypass sni blocking support. SECURITY WARNING: TLS verification will be disabled for blocked site.

func (Client) EndpointURL added in v0.2.0

func (c Client) EndpointURL(path string, values *url.Values) *url.URL

EndpointURL returns url for server endpint.

func (Client) IsLoggedIn added in v0.2.0

func (c Client) IsLoggedIn() (ret bool, err error)

IsLoggedIn checks login status base on `HEAD https://www.pixiv.net/setting_user.php` response status.

func (*Client) Login added in v0.2.0

func (c *Client) Login(username string, password string) (err error)

Login with username and password

func (*Client) SetPHPSESSID added in v0.2.0

func (c *Client) SetPHPSESSID(v string)

SetPHPSESSID set client cookie to skip login.

Jump to

Keyboard shortcuts

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