tool

package
v0.0.0-...-b4442d7 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageSystemAlipayPayToken = iota
	MessageSystemAutoPayToken
	MessageUserToken
)

Variables

View Source
var WL_am = []string{
	"51.am",
	"126.am",
}
View Source
var WL_biz = []string{
	"7daysinn.biz",
	"baozhuang.biz",
	"bengfa.biz",
	"changan.biz",
	"chinafastener.biz",
	"chongchuang.biz",
	"dahuoji.biz",
	"diandongche.biz",
	"diaoding.biz",
	"fishings.biz",
	"hanjie.biz",
	"intil.biz",
	"kuangchan.biz",
	"menchuang.biz",
	"qianyan.biz",
	"rohlan.biz",
	"runhuayou.biz",
	"shiyongjun.biz",
	"shoutao.biz",
	"tongye.biz",
	"yuanyi.biz",
	"zhaoming.biz",
}
View Source
var WL_cc = []string{}/* 151 elements not displayed */
View Source
var WL_cm = []string{
	"4.cm",
	"60.cm",
	"bearing.cm",
	"hebei.cm",
	"yinshua.cm",
}
View Source
var WL_co = []string{
	"425300.co",
	"banzhu.co",
	"hongfeng.co",
	"huas.co",
	"lixin.co",
	"xiaomayi.co",
	"xiapu.co",
	"ychdzx.co",
}
View Source
var WL_com = []string{}/* 8072 elements not displayed */
View Source
var WL_de = []string{
	"china-botschaft.de",
}
View Source
var WL_edu = []string{
	"snai.edu",
	"sxrtvu.edu",
}
View Source
var WL_fm = []string{
	"douban.fm",
	"jing.fm",
	"lvxing.fm",
}
View Source
var WL_fr = []string{
	"amb-chine.fr",
}
View Source
var WL_hk = []string{
	"95599.hk",
	"ctrip.com.hk",
	"hkidc.hk",
	"takungpao.com.hk",
	"xsren.hk",
}
View Source
var WL_im = []string{
	"cli.im",
	"iapps.im",
	"iyy.im",
	"yixin.im",
}
View Source
var WL_info = []string{
	"gmold.info",
	"iyaya.info",
	"lztech.info",
	"meihua.info",
	"williamlong.info",
}
View Source
var WL_jobs = []string{
	"cn.jobs",
}
View Source
var WL_jp = []string{
	"china-embassy.or.jp",
}
View Source
var WL_kr = []string{
	"ctrip.co.kr",
}
View Source
var WL_la = []string{
	"33.la",
	"36.la",
	"51.la",
	"55.la",
	"900.la",
	"chaxun.la",
	"iz.la",
	"qzone.la",
	"ulinix.la",
}
View Source
var WL_me = []string{
	"21me.me",
	"bole.me",
	"dzj.me",
	"kyhs.me",
	"nanxi.me",
	"shijue.me",
	"tvb.me",
	"wmpic.me",
	"yuksel.me",
}
View Source
var WL_mobi = []string{
	"i1515.mobi",
}
View Source
var WL_net = []string{}/* 925 elements not displayed */
View Source
var WL_org = []string{}/* 282 elements not displayed */
View Source
var WL_sg = []string{
	"iedu.sg",
}
View Source
var WL_sh = []string{
	"sge.sh",
}
View Source
var WL_so = []string{
	"haorenyuan.so",
	"lietou.so",
	"luyi.so",
	"shengqian.so",
	"soutudi.so",
	"wangxiao.so",
}
View Source
var WL_tm = []string{
	"stone.tm",
}
View Source
var WL_tv = []string{
	"1819.tv",
	"1866.tv",
	"1988.tv",
	"2588.tv",
	"3456.tv",
	"5588.tv",
	"5666.tv",
	"5888.tv",
	"5999.tv",
	"7999.tv",
	"9555.tv",
	"9928.tv",
	"9998.tv",
	"19888.tv",
	"005.tv",
	"0438.tv",
	"0916.tv",
	"acg.tv",
	"bilibili.tv",
	"caoxian.tv",
	"cnnl.tv",
	"cnsb.tv",
	"dengzhou.tv",
	"dydh.tv",
	"dztv.tv",
	"efang.tv",
	"gamehome.tv",
	"hao315.tv",
	"hntv.tv",
	"hoolo.tv",
	"huaihai.tv",
	"imgo.tv",
	"jiyou.tv",
	"jnnews.tv",
	"liaozhai.tv",
	"ocar.tv",
	"pengzhou.tv",
	"pps.tv",
	"qbj.tv",
	"shiqian.tv",
	"wasu.tv",
	"weihai.tv",
	"zhenping.tv",
	"zohi.tv",
}
View Source
var WL_tw = []string{
	"hexun.com.tw",
	"taiwandao.tw",
}
View Source
var WL_us = []string{
	"pangu.us",
}
View Source
var WL_ws = []string{
	"0798.ws",
}
View Source
var WhiteList = make(map[string][]string)

Functions

func Certsetup

func Certsetup() (serverTLSConf *tls.Config, clientTLSConf *tls.Config, err error)

https://tech.my-netsol.com/?p=179 关于mac的证书标准要求

func CheckCloseByReadOneByte

func CheckCloseByReadOneByte(c net.Conn, err error, readLen int, debug bool) (bool, []byte, int)

func CheckISOCode

func CheckISOCode(keyword string) string

查询国家编码是否规范用,本质上没啥用

func CopyConn

func CopyConn(src net.Conn, dst net.Conn, debug bool, limit func() bool, upTraffic func(int)) (allwritten int)

net conn copy from src to dst and process close conn

func CopyConnNoLimit

func CopyConnNoLimit() bool

func CreateHTTPClient

func CreateHTTPClient() *http.Client

func CreateSSH_KEY

func CreateSSH_KEY()

func CreateUUID

func CreateUUID() string

func Crontab

func Crontab(t time.Duration, f func(), fname string)

定时执行函数

func GetISOCodeFromCn

func GetISOCodeFromCn(cn string) string

func GetLocalIp

func GetLocalIp() net.IP

func GetMacAddrs

func GetMacAddrs() (macAddrs []string)

func GetMacAddrsString

func GetMacAddrsString() (macAddrs string)

func HandleRecover

func HandleRecover()

func InSlice

func InSlice[T string | int | int64 | int32 | int16 | int8 | uint | uint8 | uint16 | uint32 | uint64](ary []T, sub T) bool

func IsNotSupportAddr

func IsNotSupportAddr(addr string) bool

不支持Proxy访问的网站 https://www.91yunbbs.com/discussion/comment/1376/

func IsNotSupportEmail

func IsNotSupportEmail(b []byte) bool

func IsWhileList

func IsWhileList(url string) bool

白名单 国内直链接

func Keys

func Keys(validFor time.Duration) (cert, key *bytes.Buffer, fingerprint [32]byte, err error)

Keys generates a new P256 ECDSA public private key pair for TLS. It returns a bytes buffer for the PEM encoded private key and certificate.

func Md5

func Md5(str string) string

func Md5b

func Md5b(str []byte) string

func Rand

func Rand(num int64) *big.Int

[0,max)

func RandStr

func RandStr(n int) string

func RandStr2

func RandStr2(length int) string

func Rsa

func Rsa()

func RunUntilReturnTrue

func RunUntilReturnTrue(a func(b string, c string) bool, arg1 string, arg2 string)

func SendMessage

func SendMessage(text string)

使用多个token 发送消息

func SliceFilter

func SliceFilter[T any](ary []T, filter func(v T) bool) []T

func VerifyEmailFormat

func VerifyEmailFormat(email string) bool

Types

type Chacha20Stream

type Chacha20Stream struct {
	Nonce []byte

	Conn net.Conn
	// contains filtered or unexported fields
}

func NewChacha20Stream

func NewChacha20Stream(key string, Nonce int64, conn net.Conn) (*Chacha20Stream, error)

func (*Chacha20Stream) Close

func (s *Chacha20Stream) Close() error

func (*Chacha20Stream) LocalAddr

func (s *Chacha20Stream) LocalAddr() net.Addr

func (*Chacha20Stream) Read

func (s *Chacha20Stream) Read(p []byte) (int, error)

func (*Chacha20Stream) RemoteAddr

func (s *Chacha20Stream) RemoteAddr() net.Addr

func (*Chacha20Stream) SetDeadline

func (s *Chacha20Stream) SetDeadline(t time.Time) error

func (*Chacha20Stream) SetReadDeadline

func (s *Chacha20Stream) SetReadDeadline(t time.Time) error

func (*Chacha20Stream) SetWriteDeadline

func (s *Chacha20Stream) SetWriteDeadline(t time.Time) error

func (*Chacha20Stream) Write

func (s *Chacha20Stream) Write(p []byte) (int, error)

type DinToke

type DinToke struct {
	Token string
	Sec   string
	Used  bool
}

type DingMsg

type DingMsg struct {
	Msgtype string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
}

type LimitSpeed

type LimitSpeed interface {
	IsLimit(name string) bool
}

type NoneLimitSpeed

type NoneLimitSpeed struct {
}

func (NoneLimitSpeed) Islimit

func (NoneLimitSpeed) Islimit(name string) bool

type Robot

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

func NewRobot

func NewRobot(token, secret string) *Robot

func (*Robot) SendLinkMessage

func (robot *Robot) SendLinkMessage(title string, text string, messageUrl string, picUrl string) error

func (*Robot) SendMarkdownMessage

func (robot *Robot) SendMarkdownMessage(title string, text string, atMobiles []string, isAtAll bool) error

func (*Robot) SendMessage

func (robot *Robot) SendMessage(msg interface{}) error

func (*Robot) SendTextMessage

func (robot *Robot) SendTextMessage(content string, atMobiles []string, isAtAll bool) error

type SendMessageManager

type SendMessageManager struct {
	SystemAutoPayToken   []DinToke //余额自动支付
	SystemAlipayPayToken []DinToke
	UserToken            []DinToke
}
var SendMessageManagerG SendMessageManager

func (*SendMessageManager) AddUserToken

func (smm *SendMessageManager) AddUserToken(sec string, msgurl string)

添加用户token

func (*SendMessageManager) SendMessage

func (smm *SendMessageManager) SendMessage(text string, msgtype uint)

Jump to

Keyboard shortcuts

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