Documentation ¶
Overview ¶
Package proxy is an implementation of a proxy server. This package allows you to start a proxy server using a function and then provides API end-points to add and remove independent servers from this proxy server. The servers attached to the proxy must have a function in them to send a HTTP request to the proxy server to register itself in the proxy server. The server will have an option to be visible/not from direct access to it. Once the server sends a request to the proxy server to register itself, the proxy responds with a special hasb that is verified everytime a request goes through. Without this hash matching from the proxy server, the "normal" server rejects requests.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddServerReq ¶
type AddServerReq struct {
IP string
}
AddServerReq is the incoming request for adding a server to the proxy
type AddServerRes ¶
type AddServerRes struct {
Hash string
}
AddServerRes is the response for /addServer request
type Server ¶
Server holds the data about a proxy server
var ProxyServer Server
ProxyServer is the server datatype
func StartProxy ¶
StartProxy is used to start a single proxy server. Creates a new router, assigns the port to the proxy, and starts the server. The user cannot handle routing of the proxy server. All routing is handled by special mechanisms as described in adding and removing servers.