MiniWeb

package module
v0.0.0-...-3e0a51a Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2019 License: MIT Imports: 12 Imported by: 1

README

MiniWeb

纯 go 实现的 go 中的 libcurl

版本

  • 3.1.1 初次上传版本, 已可正常使用
  • 3.1.2 修改网络架构, 采用分层模型
    1. TCP基础上, 增加代理层
    2. 代理层基础上, 增加TLS支持HTTPS
  • 3.1.3 微调框架
    1. 修改GO错误处理方式为全局ERRCODE, ERRMSG模式
    2. 所有可公开常量定义定义到 mwConsts
  • 3.1.4 整体修复, 优化调整
    1. 调整, 检查, 优化现有代码, 逻辑
    2. 精简网络逻辑, 优化错误处理

使用

go get github.com/a2si/MiniWeb
  • DevLogs 这个库仅作为开发时使用的日之库, 功能并不完善, 建议使用时删除相关代码

架构

  • Cookie 对 Cookie 提供支持, 支持存储到文件
  • Header 对 ReqHeader, RspHeader 提供支持
  • Proxy
    • HTTP
    • HTTPS
    • SOCKS4
    • SOCKS4a
    • SOCKS5
    • socksV5中GSSAPI认证暂未实现, 其他功能均已正常
  • Net 基础网络层 -> 代理层 -> SSL传输层 -> 网络通讯 -> 网络完毕
    • 基础网络层
      • TCP
      • QUIC 暂未支持, 看其是否成为普遍现象
    • 代理层
      • 如果使用代理, 这里则与代理通讯
    • SSL传输层
      • 如果是 HTTPS 需要加入SSL通讯
    • 网络通讯
      • HTTP协议通讯 GET/POST/...
    • 网络完毕
      • TCP 关闭
  • Core 实现网页访问的具体功能实现

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TMiniWeb

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

func NewMiniWeb

func NewMiniWeb() *TMiniWeb

func (*TMiniWeb) ConnectWebSocket

func (self *TMiniWeb) ConnectWebSocket(URL string, cbFunc mwNet.CBHOOK) int

WebSocket 采用回调方式接收/发送信息

func (*TMiniWeb) Cookie

func (self *TMiniWeb) Cookie() *mwCookie.Cookie

暴露接口

func (*TMiniWeb) GetErrorCode

func (self *TMiniWeb) GetErrorCode() int

func (*TMiniWeb) GetErrorMsg

func (self *TMiniWeb) GetErrorMsg() string

func (*TMiniWeb) GetRedirect

func (self *TMiniWeb) GetRedirect() bool

func (*TMiniWeb) GetReferer

func (self *TMiniWeb) GetReferer() string

func (*TMiniWeb) GetStatusCode

func (self *TMiniWeb) GetStatusCode() int

func (*TMiniWeb) GetTimeOut

func (self *TMiniWeb) GetTimeOut() time.Duration

func (*TMiniWeb) GetTimeOutConnect

func (self *TMiniWeb) GetTimeOutConnect() time.Duration

func (*TMiniWeb) GetUserAgent

func (self *TMiniWeb) GetUserAgent() string

func (*TMiniWeb) GetWebCode

func (self *TMiniWeb) GetWebCode(URL string) int

func (*TMiniWeb) IsClient

func (self *TMiniWeb) IsClient()

正常模式

func (*TMiniWeb) IsWeiXin

func (self *TMiniWeb) IsWeiXin()

微信客户端模块

func (*TMiniWeb) IsXMLHttp

func (self *TMiniWeb) IsXMLHttp()

XML HTTP 模式

func (*TMiniWeb) Proxy

func (self *TMiniWeb) Proxy() *mwProxy.TProxy

暴露接口

func (*TMiniWeb) ReqHeader

func (self *TMiniWeb) ReqHeader() *mwHeader.Header

暴露接口

func (*TMiniWeb) ResponseByte

func (self *TMiniWeb) ResponseByte() []byte

func (*TMiniWeb) ResponseText

func (self *TMiniWeb) ResponseText() string

func (*TMiniWeb) RspHeader

func (self *TMiniWeb) RspHeader() *mwHeader.Header

暴露接口

func (*TMiniWeb) SendRequest

func (self *TMiniWeb) SendRequest(URL string) int

func (*TMiniWeb) SetErrorCode

func (self *TMiniWeb) SetErrorCode(Code int)

func (*TMiniWeb) SetErrorMsg

func (self *TMiniWeb) SetErrorMsg(Msg string)

func (*TMiniWeb) SetHttpMethod

func (self *TMiniWeb) SetHttpMethod(Method string)

func (*TMiniWeb) SetPOST

func (self *TMiniWeb) SetPOST(data map[string]string)

MAP 方法, 数据顺序会改变

func (*TMiniWeb) SetPOSTFile

func (self *TMiniWeb) SetPOSTFile(Name string, FileName string)

func (*TMiniWeb) SetRedirect

func (self *TMiniWeb) SetRedirect(Redirect bool)

func (*TMiniWeb) SetReferer

func (self *TMiniWeb) SetReferer(Referer string)

func (*TMiniWeb) SetTimeOut

func (self *TMiniWeb) SetTimeOut(TimeOut time.Duration)

func (*TMiniWeb) SetTimeOutConnect

func (self *TMiniWeb) SetTimeOutConnect(TimeOutConnect time.Duration)

func (*TMiniWeb) SetURL

func (self *TMiniWeb) SetURL(URL string)

func (*TMiniWeb) SetUserAgent

func (self *TMiniWeb) SetUserAgent(UserAgent string)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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