models

package
v0.0.0-...-5a8df17 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HTTP代理
	ProtocolTypeHTTP int = 1
	// HTTPS代理
	ProtocolTypeHTTPS int = 2
	// HTTP/HTTPS代理
	ProtocolTypeALL int = 3
)

代理协议类型

View Source
const (
	// 透明代理
	AnonymousTypeT int = 1
	// 匿名代理
	AnonymousTypeN int = 2
	// 混淆代理
	AnonymousTypeH int = 3
	// 高匿代理
	AnonymousTypeG int = 4
)

代理匿名类型

View Source
const (
	PrefixProtocolHttp  = "http://"
	PrefixProtocolHttps = "https://"
	TestUrlHttp         = "http://httpbin.org/get?show_env=1"
	TestUrlHttps        = "https://httpbin.org/get?show_env=1"
)

Variables

View Source
var DB *gorm.DB

DB 数据库链接单例

View Source
var LocalIp = ""

Functions

func Delete

func Delete(proxyIP *ProxyIP)

func Exist

func Exist(proxyIP *ProxyIP) bool

func Init

func Init()

Init 初始化 MySQL 链接

func ProxyCount

func ProxyCount() (int64, error)

func ProxyDelete

func ProxyDelete(ip, port string)

func ProxyRandomCount

func ProxyRandomCount(anonymous, protocols []int, countries []string) (int64, error)

func Save

func Save(proxyIP *ProxyIP)

Types

type ProxyIP

type ProxyIP struct {
	IP          string `gorm:"primary_key"` // IP
	Port        string `gorm:"primary_key"` // Port端口
	Protocol    int    // 代理协议类型 HTTP:1 HTTPS:2 HTTP/HTTPS:3
	Anonymous   int    // 匿名类型 透明:1 普通匿名:2 欺骗匿名:3 高匿:4
	Country     string // 国家
	Province    string // 省
	Attribution string // 归属 全路径
	ISP         string // 运营商
	Score       int    // 分数 默认10分
	Source      string // 来源
	Speed       int64  // 连接速度 单位ms
	CreateTime  string // 创建时间
	LastTime    string // 最后检测时间
	FailedCount int    // 连续失败次数 扣分时采用 Score - (2 * FailedCount + 1)
}

Proxy 代理IP模型

func ProxyAll

func ProxyAll(anonymous, protocols []int, countries []string, page, pageSize int) ([]ProxyIP, error)

func ProxyRandom

func ProxyRandom(anonymous, protocols []int, countries []string) (ProxyIP, error)

func (*ProxyIP) CheckIP

func (proxyIP *ProxyIP) CheckIP() bool

func (*ProxyIP) GetAnonymous

func (proxyIP *ProxyIP) GetAnonymous(origin string) int

func (*ProxyIP) GetIpInfo

func (proxyIP *ProxyIP) GetIpInfo()

TODO ip_c_list数组值判断

func (*ProxyIP) String

func (proxyIP *ProxyIP) String() string

Jump to

Keyboard shortcuts

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