eth

package
v0.0.0-...-83feed8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

网络相关的封装放本文件

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPv4StrToUint32

func IPv4StrToUint32(ip string) uint32

ipv4格式的地址字符串转uint32

func Uint32ToIPv4Str

func Uint32ToIPv4Str(intip uint32) string

ipv4 uint32转字符串

Types

type Eth

type Eth struct {
	Name         string
	IP4Addr      []string
	IP4IntAddr   []uint32
	HardwareAddr string
	Flags        net.Flags
}

func LiveEths

func LiveEths() ([]Eth, error)

获取本地所有活跃的网卡信息

type NetAddr

type NetAddr struct {
	Addr        string `json:"addr"`        // 地址
	City        string `json:"city"`        // 城市
	CityCode    string `json:"cityCode"`    // 城市邮政编码
	Err         string `json:"err"`         // 如果有错误的话提示
	IP          string `json:"ip"`          // 公网ip
	Pro         string `json:"pro"`         // 省
	ProCode     string `json:"proCode"`     // 省邮政编码
	Region      string `json:"region"`      //
	RegionCode  string `json:"regionCode"`  //
	RegionNames string `json:"regionNames"` //
}

func PubblicAddr

func PubblicAddr(localIP string) (NetAddr, error)

公网地址 localIP 指定本机走那个网卡地址,可以为空

Jump to

Keyboard shortcuts

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