client

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2020 License: MIT Imports: 16 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 DNSQueryURL string = os.Getenv("PIXIV_DNS_QUERY_URL")

DNSQueryURL is DNS over HTTPS service url that act like google public dns json api https://developers.google.com/speed/public-dns/docs/doh/json

View Source
var Default = &Client{}

Default client auto login with PIXIV_PHPSESSID env var.

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

Hosts rules like /etc/hosts

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.

func With added in v0.4.0

func With(ctx context.Context, v *Client) context.Context

With set client to context.

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 For added in v0.4.0

func For(ctx context.Context) *Client

For get client from context.

func (*Client) BypassSNIBlocking added in v0.3.2

func (c *Client) BypassSNIBlocking()

BypassSNIBlocking wrap current transport with bypass sni blocking support.

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) GetWithContext added in v0.4.0

func (c *Client) GetWithContext(ctx context.Context, url string) (resp *http.Response, err error)

GetWithContext create get request with context and do it.

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