network

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

* url functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CanConnect

func CanConnect(ip, port string) bool

func ChangeMask

func ChangeMask(mask string) string

* net mask转换, 255.255.255.0 -> 24 * 2019/03/07

func CheckToken

func CheckToken(token string) (bool, string)

*

  • 验证token

func CreateTokenWithTime

func CreateTokenWithTime(sToken string) string

*

  • 生成一个token

func FnPost

func FnPost(url, param string) ([]byte, error)

*

  • post 请求

func GetInternetIps

func GetInternetIps() []string

*

  • 取外网IP

func GetIpMaskFromCIDR

func GetIpMaskFromCIDR(ip string) (string, string, error)

* CIDR取IP mask * 2019/03/07

func GetIpPortFromUrl

func GetIpPortFromUrl(sUrl string) (string, string, error)

*

  • 从url中取域名,端口
  • 2019/05/20

func GetLocalIp

func GetLocalIp() string

*

  • 取本地IP

func GetLocalIps

func GetLocalIps() []string

*

  • 取本地IP

func GetNumber

func GetNumber(ip, mask string) (string, error)

*

  • ip是否正确

func GetRemoteIp

func GetRemoteIp(req *http.Request) string

*

  • 取来源地址

func IsPrivateIp

func IsPrivateIp(ip string) bool

*

  • 是否本地(局域网)IP

func MethodHttp

func MethodHttp(method, url, param string, header ...map[string]string) ([]byte, error)

*

  • 自定义HTTP请求

func Ping

func Ping(ip string) bool

func QuerySign

func QuerySign(mQuery map[string]string) string

*

  • 给参数签名

func RandInt64

func RandInt64(min, max int64) int64

*

  • 取随机数

func RandPort

func RandPort(min, max int64) int64

*

  • 取随机端口

func ScanPort

func ScanPort(startPort, endPort int64, count int) []int64

*

  扫描本机空闲端口
 	参数说明:
	startPort  扫描开始端口 不包含这个端口
	endPort    扫描结束端口 不包含这个端口
	count    	扫描端口数量

func SendHttp

func SendHttp(method, url string, param map[string]string, header ...map[string]string) ([]byte, error)

*

  • 自定义HTTP请求

Types

This section is empty.

Jump to

Keyboard shortcuts

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