Documentation
¶
Index ¶
- Variables
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func CheckComponentExist(model string) (bool, error)
- func CheckmDNSServiceInfo(info map[string]string) error
- func GetExternalIpPortByKCP(listener *net.UDPConn, token *models.TokenClaims) (*net.UDPAddr, error)
- func GetExternalIpPortByUDP(listener *net.UDPConn, token *models.TokenClaims) (ip string, port int, err error)
- func GetIntranetIp() string
- func GetMacs() ([]string, error)
- func GetMyPublicIpInfo() (string, error)
- func GetOneFreeTcpPort() (int, error)
- func IsChinaIP(IP net.IP) bool
- func IsPublicIP(IP net.IP) bool
- func MustAsset(name string) []byte
- func RegistermDNSService(info map[string]string, port int) (*zeroconf.Server, error)
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- func RunKCPApiServer(port int)
- func RunUDPApiServer(port int)
- func SetYamuxConn(kcpconn *kcp.UDPSession)
- type IP
- type IPInfo
Constants ¶
This section is empty.
Variables ¶
var MDNSServiceBaseInfo = map[string]string{
"name": "OpenIoTHub服务",
"model": "com.iotserv.services.web",
"author": "Farry",
"email": "newfarry@126.com",
"home-page": "https://github.com/OpenIoTHub",
"firmware-respository": "https://github.com/iotdevice",
"firmware-version": "1.0",
}
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func CheckComponentExist ¶
func CheckmDNSServiceInfo ¶
检查mdns发布的服务的信息是否存在错误
func GetExternalIpPortByKCP ¶ added in v0.0.27
获取一个listener的外部地址和端口
func GetExternalIpPortByUDP ¶ added in v0.0.27
func GetExternalIpPortByUDP(listener *net.UDPConn, token *models.TokenClaims) (ip string, port int, err error)
获取一个listener的外部地址和端口
func IsPublicIP ¶
10.0.0.0/8:10.0.0.0~10.255.255.255 172.16.0.0/12:172.16.0.0~172.31.255.255 192.168.0.0/16:192.168.0.0~192.168.255.255
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RegistermDNSService ¶
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
func RunKCPApiServer ¶ added in v0.0.27
func RunKCPApiServer(port int)
func RunUDPApiServer ¶ added in v0.0.27
func RunUDPApiServer(port int)
func SetYamuxConn ¶ added in v0.0.5
func SetYamuxConn(kcpconn *kcp.UDPSession)
Types ¶
type IP ¶
type IP struct {
Ip string `json:"ip"`
Country string `json:"country"`
Area string `json:"area"`
Region string `json:"region"`
City string `json:"city"`
County string `json:"county"`
Isp string `json:"isp"`
CountryId string `json:"country_id"`
AreaId string `json:"area_id"`
RegionId string `json:"region_id"`
CityId string `json:"city_id"`
CountyId string `json:"county_id"`
IspId string `json:"isp_id"`
}