communication

package
v0.0.0-...-e457aa1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ERROR_MESSAGE = "Error while sending request"
View Source
const HTTPS_PROTOCOL = "https"
View Source
const HTTPS_REQUEST = "HTTPS_REQUEST"
View Source
const HTTP_DELETE = "DELETE"
View Source
const HTTP_GET = "GET"
View Source
const HTTP_POST = "POST"
View Source
const HTTP_PROTOCOL = "http"
View Source
const HTTP_PUT = "PUT"
View Source
const HTTP_REQUEST = "HTTP_REQUEST"
View Source
const SUCCESS_MESSAGE = "Success"

Variables

This section is empty.

Functions

func IsInstanceOf

func IsInstanceOf(typeName string, typeInterface interface{}) bool

func SetDefaultProxyServer

func SetDefaultProxyServer(proxyServer *ProxyServer)

func SetDefaultServer

func SetDefaultServer(server *Server)

Types

type BaseConnector

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

func (*BaseConnector) GetProtocol

func (baseConnector *BaseConnector) GetProtocol() string

func (*BaseConnector) GetTimeout

func (baseConnector *BaseConnector) GetTimeout() int64

func (*BaseConnector) SetProtocol

func (baseConnector *BaseConnector) SetProtocol(protocol string)

func (*BaseConnector) SetTimeout

func (baseConnector *BaseConnector) SetTimeout(timeout int64)

func (*BaseConnector) ValidateRequest

func (baseConnector *BaseConnector) ValidateRequest(req Request) bool

type Connector

type Connector interface {
	SetProtocol(protocol string)
	GetProtocol() string
	SetTimeout(timeout int64)
	GetTimeout() int64
	SendRequest(request Request) *Response
}

func GetConnector

func GetConnector(protocol string) Connector

type HttpConnector

type HttpConnector struct {
	BaseConnector
}

func (*HttpConnector) SendRequest

func (httpConnector *HttpConnector) SendRequest(request Request) *Response

type HttpRequest

type HttpRequest struct {
	Server          *Server
	ProxyServer     *ProxyServer
	IsProxy         bool
	IsSecure        bool
	Method          string
	Api             string
	Data            []byte
	DataType        string
	ResponseAction  string
	IsParseResponse bool
	Headers         map[string]interface{}
	CustomParams    map[string]interface{}
	Logger          *glog.Logger
	LoggerName      string
	UploadFilePath  string
	UploadFileName  string
}

func NewHttpRequest

func NewHttpRequest(server *Server, proxyServer *ProxyServer) *HttpRequest

func (*HttpRequest) GetProxyServer

func (httpRequest *HttpRequest) GetProxyServer() *ProxyServer

func (*HttpRequest) GetServer

func (httpRequest *HttpRequest) GetServer() *Server

func (*HttpRequest) RequestInit

func (httpRequest *HttpRequest) RequestInit()

type HttpsConnector

type HttpsConnector struct {
	BaseConnector
}

func (*HttpsConnector) SendRequest

func (httpsConnector *HttpsConnector) SendRequest(request Request) *Response

type HttpsRequest

type HttpsRequest struct {
	HttpRequest
}

func NewHttpsRequest

func NewHttpsRequest(server *Server, proxyServer *ProxyServer) *HttpsRequest

func (*HttpsRequest) GetProxyServer

func (httpsRequest *HttpsRequest) GetProxyServer() *ProxyServer

func (*HttpsRequest) GetServer

func (httpsRequest *HttpsRequest) GetServer() *Server

func (*HttpsRequest) RequestInit

func (httpsRequest *HttpsRequest) RequestInit()

type ProxyServer

type ProxyServer struct {
	Host     string
	Port     int
	Protocol string
	UserName string
	Password string
}

Proxy server

func GetDefaultProxyServer

func GetDefaultProxyServer() *ProxyServer

func (ProxyServer) New

func (proxyServer ProxyServer) New(host string, port int, protocol string, userName string, password string) ProxyServer

type Request

type Request interface {
	RequestInit()
	GetServer() *Server
}

type Response

type Response struct {
	StatusCode   string
	Error        error
	Message      string
	ResponseData interface{}
}

type Server

type Server struct {
	Host     string
	Port     int
	Protocol string
}

Server

func GetDefaultServer

func GetDefaultServer() *Server

func (Server) New

func (server Server) New(host string, port int, protocol string) Server

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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