osx

package
v0.11.5 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2024 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Overview

* @Author: kamalyes 501893067@qq.com * @Date: 2023-07-28 00:50:58 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-09 20:09:14 * @FilePath: \go-toolbox\pkg\osx\base.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-28 09:52:21 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-10-28 10:10:17 * @FilePath: \go-toolbox\pkg\osx\file.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

* @Author: kamalyes 501893067@qq.com * @Date: 2024-10-24 11:25:16 * @LastEditors: kamalyes 501893067@qq.com * @LastEditTime: 2024-11-08 13:18:55 * @FilePath: \go-toolbox\pkg\osx\pool.go * @Description: * * Copyright (c) 2024 by kamalyes, All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckImageExists

func CheckImageExists(filename string) error

CheckImageExists 检查图像文件是否存在并且有效

func GetClientPublicIP added in v0.11.5

func GetClientPublicIP(r *http.Request) (string, error)

GetClientPublicIP 从HTTP请求中获取客户端的公网IP地址。 如果无法确定公网IP,则返回空字符串和错误(如果适用)。

func GetConNetPublicIp added in v0.11.5

func GetConNetPublicIp(urls ...string) (string, error)

GetConNetPublicIp 联网获取本机公网 IP

func GetDirFiles

func GetDirFiles(dir string) ([]string, error)

GetDirFiles 获取指定目录及其子目录下的所有文件路径 参数:dir - 目录路径 返回:所有文件的路径切片和可能的错误

func GetHostName added in v0.11.5

func GetHostName() (string, error)

GetHostName 获取主机名,如果失败则返回错误

func GetLocalInterfaceIeIp added in v0.11.5

func GetLocalInterfaceIeIp() (string, string, error)

GetLocalInterfaceIeIp 返回本地网卡对应的外部和内部 IP 地址

func GetLocalInterfaceIps added in v0.11.5

func GetLocalInterfaceIps() ([]net.IP, error)

GetLocalInterfaceIps 查询本机网卡所有IP

func HashUnixMicroCipherText

func HashUnixMicroCipherText() string

HashUnixMicroCipherText

func SafeGetHostName

func SafeGetHostName() string

获取主机名函数

func SaveImage

func SaveImage(filename string, imgData []byte, quality int) error

SaveImage 将字节数据保存为指定文件名的图片

Types

type LimitedPool added in v0.11.5

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

LimitedPool 管理多个 levelPool,以支持不同大小的字节切片

func NewLimitedPool added in v0.11.5

func NewLimitedPool(minSize, maxSize int) *LimitedPool

NewLimitedPool 创建一个新的 LimitedPool,指定最小和最大大小

func (*LimitedPool) Get added in v0.11.5

func (p *LimitedPool) Get(size int) *[]byte

Get 从池中获取指定大小的字节切片

func (*LimitedPool) Put added in v0.11.5

func (p *LimitedPool) Put(b *[]byte)

Put 将字节切片放回池中以供重用

Jump to

Keyboard shortcuts

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