storage

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsCookie

func ContainsCookie(cookies []*http.Cookie, name string) bool

ContainsCookie 检查是否有指定名称的Cookie

func StringifyCookies

func StringifyCookies(cookies []*http.Cookie) string

StringifyCookies 将Cookie转为字符串

func UnstringifyCookies

func UnstringifyCookies(s string) []*http.Cookie

UnstringifyCookies 将字符串转为Cookie

Types

type InMemoryStorage

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

InMemoryStorage 默认存储器,将Cookies和网址保存在内存中

func (*InMemoryStorage) Close

func (s *InMemoryStorage) Close() error

Close 实现Storage.Close()

func (*InMemoryStorage) Cookies

func (s *InMemoryStorage) Cookies(u *url.URL) string

Cookies 获取指定URL的Cookies

func (*InMemoryStorage) Init

func (s *InMemoryStorage) Init() error

Init 初始化存储器

func (*InMemoryStorage) IsVisited

func (s *InMemoryStorage) IsVisited(requestID uint64) (bool, error)

IsVisited 检查指定请求ID是否已经访问

func (*InMemoryStorage) SetCookies

func (s *InMemoryStorage) SetCookies(u *url.URL, cookies string)

SetCookies 设置指定URL的Cookie

func (*InMemoryStorage) Visited

func (s *InMemoryStorage) Visited(requestID uint64) error

Visited 设置指定请求ID为已访问

type Storage

type Storage interface {
	// Init 初始化存储器
	Init() error

	// Visited 设置指定请求ID为已访问
	Visited(requestID uint64) error

	// IsVisited 检查指定请求ID是否已经访问
	IsVisited(requestID uint64) (bool, error)

	// Cookies 获取指定URL的Cookies
	Cookies(u *url.URL) string

	// SetCookies 设置指定URL的Cookie
	SetCookies(u *url.URL, cookies string)
}

Storage 存储Collector内部数据的接口

Jump to

Keyboard shortcuts

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