Documentation ¶
Overview ¶
xldl project xldl.go api说明见:http://open.xunlei.com/wiki/api_doc.html#1
Index ¶
- Constants
- func InitXLEngine() bool
- func UnInitXLEngine() bool
- func XL_CreateBTTaskByThunder(pszPath string) uint32
- func XL_CreateTask(param *DownTaskParam) uintptr
- func XL_CreateTaskByThunder(pszUrl, pszFileName, pszReferUrl, pszCharSet, pszCookie string) uint32
- func XL_CreateTaskByURL(url, path, filename string, IsResume int32) uintptr
- func XL_DelTempFile(stParam *DownTaskParam) bool
- func XL_DeleteTask(hTask uintptr) bool
- func XL_ForceStopTask(hTask uintptr) bool
- func XL_GetFileSizeWithUrl(lpURL string) (int64, bool)
- func XL_Init() bool
- func XL_ParseThunderPrivateUrl(pszThunderUrl string) (string, bool)
- func XL_SetFileIdAndSize(hTask uintptr, szFileId FileId, nFileSize uint64) bool
- func XL_SetProxy(stProxyInfo *DOWN_PROXY_INFO) bool
- func XL_SetSpeedLimit(nKBps int32)
- func XL_SetUploadSpeedLimit(nTcpKBps, nOtherKBps uint32)
- func XL_SetUserAgent(pszUserAgent string)
- func XL_StartTask(hTask uintptr) bool
- func XL_StopTask(hTask uintptr) bool
- func XL_UnInit() bool
- type DOWN_PROXY_AUTH_TYPE
- type DOWN_PROXY_INFO
- type DOWN_PROXY_TYPE
- type DOWN_TASK_STATUS
- type DownTaskInfo
- type DownTaskParam
- type FileId
- type TASK_ERROR_TYPE
- type XLDownloader
- type XLTask
Constants ¶
View Source
const ( NOITEM = 0 + iota TSC_ERROR TSC_PAUSE TSC_DOWNLOAD TSC_COMPLETE TSC_STARTPENDING TSC_STOPPENDING )
View Source
const ( TASK_ERROR_UNKNOWN = 0x00 // 未知错误 TASK_ERROR_DISK_CREATE = 0x01 // 创建文件失败 TASK_ERROR_DISK_WRITE = 0x02 // 写文件失败 TASK_ERROR_DISK_READ = 0x03 // 读文件失败 TASK_ERROR_DISK_RENAME = 0x04 // 重命名失败 TASK_ERROR_DISK_PIECEHASH = 0x05 // 文件片校验失败 TASK_ERROR_DISK_FILEHASH = 0x06 // 文件全文校验失败 TASK_ERROR_DISK_DELETE = 0x07 // 删除文件失败失败 TASK_ERROR_DOWN_INVALID = 0x10 // 无效的DOWN地址 TASK_ERROR_PROXY_AUTH_TYPE_UNKOWN = 0x20 // 代理类型未知 TASK_ERROR_PROXY_AUTH_TYPE_FAILED = 0x21 // 代理认证失败 TASK_ERROR_HTTPMGR_NOT_IP = 0x30 // http下载中无ip可用 TASK_ERROR_TIMEOUT = 0x40 // 任务超时 TASK_ERROR_CANCEL = 0x41 // 任务取消 TASK_ERROR_TP_CRASHED = 0x42 // MINITP崩溃 TASK_ERROR_ID_INVALID = 0x43 // TaskId 非法 )
View Source
const ( PROXY_TYPE_IE = 0 PROXY_TYPE_HTTP = 1 PROXY_TYPE_SOCK4 = 2 PROXY_TYPE_SOCK5 = 3 PROXY_TYPE_FTP = 4 PROXY_TYPE_UNKOWN = 255 )
View Source
const ( PROXY_AUTH_NONE = 0 + iota PROXY_AUTH_AUTO PROXY_AUTH_BASE64 PROXY_AUTH_NTLM PROXY_AUTH_DEGEST PROXY_AUTH_UNKOWN )
View Source
const (
MAX_PATH = 260
)
Variables ¶
This section is empty.
Functions ¶
func InitXLEngine ¶
func InitXLEngine() bool
func UnInitXLEngine ¶
func UnInitXLEngine() bool
func XL_CreateTask ¶
func XL_CreateTask(param *DownTaskParam) uintptr
func XL_CreateTaskByThunder ¶
func XL_CreateTaskByURL ¶
func XL_DelTempFile ¶
func XL_DelTempFile(stParam *DownTaskParam) bool
func XL_DeleteTask ¶
func XL_ForceStopTask ¶
func XL_GetFileSizeWithUrl ¶
func XL_SetFileIdAndSize ¶
func XL_SetProxy ¶
func XL_SetProxy(stProxyInfo *DOWN_PROXY_INFO) bool
func XL_SetSpeedLimit ¶
func XL_SetSpeedLimit(nKBps int32)
func XL_SetUploadSpeedLimit ¶
func XL_SetUploadSpeedLimit(nTcpKBps, nOtherKBps uint32)
func XL_SetUserAgent ¶
func XL_SetUserAgent(pszUserAgent string)
func XL_StartTask ¶
func XL_StopTask ¶
Types ¶
type DOWN_PROXY_AUTH_TYPE ¶
type DOWN_PROXY_AUTH_TYPE int32
type DOWN_PROXY_INFO ¶
type DOWN_PROXY_INFO struct { IEProxy int32 Proxy int32 PType DOWN_PROXY_TYPE AType DOWN_PROXY_AUTH_TYPE Host [2048]uint16 Port int32 User [50]uint16 Pwd [50]uint16 Domain [2048]uint16 }
type DOWN_PROXY_TYPE ¶
type DOWN_PROXY_TYPE int32
type DOWN_TASK_STATUS ¶
type DOWN_TASK_STATUS int32
type DownTaskInfo ¶
type DownTaskInfo struct { Stat DOWN_TASK_STATUS FailCode TASK_ERROR_TYPE Filename [MAX_PATH]uint16 Reserved0 [MAX_PATH]uint16 TotalSize int64 // 该任务总大小(字节) TotalDownload int64 // 下载有效字节数(可能存在回退的情况) Percent float32 // 下载进度 SrcTotal int32 // 总资源数 SrcUsing int32 // 可用资源数 DonationP2P int64 // p2p贡献字节数 DonationOrgin int64 // 原始资源共享字节数 DonationP2S int64 // 镜像资源共享字节数 Speed int32 // 即时速度(字节/秒) SpeedP2S int32 // 即时速度(字节/秒) SpeedP2P int32 // 即时速度(字节/秒) // contains filtered or unexported fields }
他按4字节对齐的,然迅雷要求按1字节对齐,so下面两个有问题了,要换种方式了
func XL_QueryTaskInfoEx ¶
func XL_QueryTaskInfoEx(hTask uintptr) (*DownTaskInfo, bool)
func (*DownTaskInfo) IsCreatingFile ¶
func (c *DownTaskInfo) IsCreatingFile() bool
func (*DownTaskInfo) IsOriginUsable ¶
func (c *DownTaskInfo) IsOriginUsable() bool
func (*DownTaskInfo) SetDefault ¶
func (c *DownTaskInfo) SetDefault()
func (*DownTaskInfo) SetIsCreatingFile ¶
func (c *DownTaskInfo) SetIsCreatingFile(val bool)
func (*DownTaskInfo) SetIsOriginUsable ¶
func (c *DownTaskInfo) SetIsOriginUsable(val bool)
type DownTaskParam ¶
type DownTaskParam struct { IsOnlyOriginal int32 // 是否只从原始地址下载 DisableAutoRename int32 // 禁止智能命名 IsResume int32 // 是否用续传 // contains filtered or unexported fields }
func (*DownTaskParam) SetDefault ¶
func (c *DownTaskParam) SetDefault()
type TASK_ERROR_TYPE ¶
type TASK_ERROR_TYPE int32
type XLDownloader ¶
func NewXLDownloader ¶
func NewXLDownloader(savePath string) *XLDownloader
func (*XLDownloader) AddTask ¶
func (self *XLDownloader) AddTask(wstrUrl, wstrFileName string) *XLTask
func (*XLDownloader) Remove ¶
func (self *XLDownloader) Remove(task *XLTask)
func (*XLDownloader) RemoveAll ¶
func (self *XLDownloader) RemoveAll()
Click to show internal directories.
Click to hide internal directories.