Compare commits
No commits in common. "v0.2.1" and "master" have entirely different histories.
23
callback.go
23
callback.go
@ -1,23 +0,0 @@
|
||||
package cwclient
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// Callback 发送代理连接获取内容后的回调函数
|
||||
type Callback struct {
|
||||
label string
|
||||
hash string
|
||||
Do func(cxt *CallbackContext)
|
||||
}
|
||||
|
||||
// CallbackContext Callback上下文
|
||||
type CallbackContext struct {
|
||||
TaskID string
|
||||
Content string
|
||||
Error error
|
||||
Carry interface{} // 传递的参数.
|
||||
}
|
||||
|
||||
// ContentJSON 返回 json反序列化的对象
|
||||
func (cxt *CallbackContext) ContentJSON(obj interface{}) error {
|
||||
return json.Unmarshal([]byte(cxt.Content), obj)
|
||||
}
|
||||
15
client.go
15
client.go
@ -21,6 +21,21 @@ func init() {
|
||||
log.SetFlags(log.Llongfile | log.LstdFlags)
|
||||
}
|
||||
|
||||
// CallbackContext Callback上下文
|
||||
type CallbackContext struct {
|
||||
TaskID string
|
||||
Content string
|
||||
Error error
|
||||
Carry interface{} // 传递的参数.
|
||||
}
|
||||
|
||||
// Callback 发送代理连接获取内容后的回调函数
|
||||
type Callback struct {
|
||||
label string
|
||||
hash string
|
||||
Do func(cxt *CallbackContext)
|
||||
}
|
||||
|
||||
// Client 客户端
|
||||
type Client struct {
|
||||
chromeProxyAddr string
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user