personification

package
v0.0.0-...-6775195 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: AGPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyPerson = &person{
	userInfo: UserInfo{
		User:   &udetect.User{},
		Device: &udetect.DeviceDefault,
		Geo:    &udetect.GeoDefault,
	},
}

Functions

This section is empty.

Types

type Client

type Client interface {
	Detect(ctx context.Context, req *udetect.Request) (*udetect.Response, error)
}

Client interface

type DummyClient

type DummyClient struct {
}

func (DummyClient) Detect

type Item

type Item struct {
	ID   uint
	Name string
}

type Person

type Person interface {
	// User info data
	UserInfo() *UserInfo

	// IsInited person in database
	IsInited() bool

	// Properties for domain
	Properties(name string) Properties

	// Predict what does he likes?
	Predict(req *PredictRequest) (*PredictResponse, error)

	// PredictPrice what minimal
	PredictPrice(req *PredictPriceRequest) (*PredictPriceResponse, error)
}

Person information block

type PredictPriceRequest

type PredictPriceRequest struct{}

PredictPriceRequest ...

type PredictPriceResponse

type PredictPriceResponse struct{}

PredictPriceResponse ...

type PredictRequest

type PredictRequest struct{}

PredictRequest ...

type PredictResponse

type PredictResponse struct{}

PredictResponse ...

type Properties

type Properties interface {
	// Get property by key
	Get(key string) any

	// GetString property by key
	GetString(key string) string

	// GetIntSlice property by key
	GetIntSlice(key string) []int

	// Set property
	Set(key string, prop any)

	// Delete property by key
	Delete(key string)

	// Synchronise properties
	Synchronise() error
}

Properties accessor

type Signature

type Signature struct {
	UUIDName       string
	SessidName     string
	SessidLifetime time.Duration
	Detector       Client
}

Signature provides the builder of cookie assigned to the user by HTTP

func (*Signature) SignCookie

func (sign *Signature) SignCookie(resp Person, req *fasthttp.RequestCtx)

SignCookie do sign request by traking response

func (*Signature) Whois

func (sign *Signature) Whois(ctx context.Context, req *fasthttp.RequestCtx) (Person, error)

Whois user information

type SimpleClient

type SimpleClient struct {
	BrowserList []*Item
	OSList      []*Item
}

func (*SimpleClient) Detect

func (s *SimpleClient) Detect(ctx context.Context, req *udetect.Request) (*udetect.Response, error)

type UserInfo

type UserInfo struct {
	User   *udetect.User
	Device *udetect.Device
	Geo    *udetect.Geo
}

UserInfo value

func (*UserInfo) Ages

func (i *UserInfo) Ages() (from, to int)

Ages of the user

func (*UserInfo) CarrierInfo

func (i *UserInfo) CarrierInfo() *udetect.Carrier

GeoInfo get method

func (*UserInfo) Country

func (i *UserInfo) Country() *udetect.Geo

Country info

func (*UserInfo) DeviceInfo

func (i *UserInfo) DeviceInfo() *udetect.Device

DeviceInfo get method

func (*UserInfo) ETag

func (i *UserInfo) ETag() string

ETag of the user

func (*UserInfo) Fingerprint

func (i *UserInfo) Fingerprint() string

Fingerprint of the iser

func (*UserInfo) GeoInfo

func (i *UserInfo) GeoInfo() *udetect.Geo

GeoInfo get method

func (*UserInfo) Keywords

func (i *UserInfo) Keywords() string

Keywords of the user

func (*UserInfo) MostPossibleSex

func (i *UserInfo) MostPossibleSex() int

MostPossibleSex of the user

func (*UserInfo) SessionID

func (i *UserInfo) SessionID() string

SessionID of the user

func (*UserInfo) UUID

func (i *UserInfo) UUID() string

UUID of the user

Jump to

Keyboard shortcuts

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