Documentation ¶
Index ¶
- Constants
- Variables
- func CheckIPIsLocalIP(ipaddr string) bool
- func CheckIsDirByPath(path string) bool
- func CreateSocketConnect(ipAddr string, port int) (conn net.Conn, err error)
- func CreateSocketListen(ipAddr string, port int) (tcpListen *net.TCPListener, err error)
- func GetCurrentFileList(filePath string) (filelist, filedir []string, err error)
- func GetLocalIP() string
- func HashFile(filename string) (hash string, err error)
- func MkdirAllByPath(dirPath string) bool
- func RecvFile(ctx context.Context, conn net.Conn, filename string, filesize uint64) (flag bool, err error)
- func SendFile(ctx context.Context, conn net.Conn, filename string) (sendLen int64, err error)
- func SetStructByJSON(obj interface{}, mapData map[string]interface{}) error
- type FileInfo
- type RespMessage
- type Semaphore
Constants ¶
View Source
const ( TASK_CREATE = "1010" //任务创建 TASK_START = "1020" //任务开始 TASK_SROP = "1030" //任务暂停 TASK_UPDATE = "1040" //任务修改 TASK_DELETE = "1050" //任务删除 TASK_UNABLE = "1060" //无效任务 )
View Source
const ( FILE_COPY = iota //文件复制 FILE_CUT //文件移动 )
View Source
const ( TASK_IS_STOP = iota //任务停止 TASK_IS_RUNED //任务完成 TASK_IS_RUNNING //任务运行中 )
View Source
const ( TRAN_DIR = iota //传输目录 TRAN_FILE //传输文件 )
Variables ¶
View Source
var ( MAX_MESSAGE_LEN = 1024 //每次接收消息的最大长度(字节) MAX_FILE_DATA_LEN = 16 * 1024 * 1024 //每次接收文件数据的最大长度(字节) )
Functions ¶
func CheckIPIsLocalIP ¶
Check IP is local ip address returns true or false
func CheckIsDirByPath ¶
check path is dir returns true/false
func CreateSocketConnect ¶
func CreateSocketListen ¶
func CreateSocketListen(ipAddr string, port int) (tcpListen *net.TCPListener, err error)
func GetCurrentFileList ¶
Get current file list by file full path returns the file list or err
func MkdirAllByPath ¶
Mkdir all by full path returns true/false
func SetStructByJSON ¶
SetStructByJSON 由json对象生成 struct
Types ¶
type RespMessage ¶
func (*RespMessage) CheckRespIsTureOrFalse ¶
func (this *RespMessage) CheckRespIsTureOrFalse(respJson []byte) bool
func (*RespMessage) GetRespMessageJson ¶
func (this *RespMessage) GetRespMessageJson() string
Response json pack
type Semaphore ¶
func NewSemaphore ¶
Click to show internal directories.
Click to hide internal directories.