Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPRequest ¶
type HTTPRequest struct { Method string `json:"method"` URL string `json:"url"` Headers map[string]string `json:"headers"` HeadersHash string `json:"headersHash"` Body string `json:"body"` ResponseId string `json:"responseId"` Timestamp time.Time `json:"timestamp"` }
HTTPRequest is a HTTP request from Harp to the app enclosed in a WebSocket message
type HTTPResponse ¶
type HTTPResponse struct { Status int `json:"status"` StatusCode int `json:"statusCode"` Headers map[string]string `json:"headers"` Body string `json:"body"` ResponseId string `json:"responseId"` Timestamp time.Time `json:"timestamp"` Cacheable bool `json:"cacheable"` Latency time.Duration `json:"latency"` }
HTTPResponse is a HTTP response from the app to Harp enclosed in a WebSocket message
type Registration ¶
type Registration struct { Name string `json:"name"` Domain string `json:"domain"` Key string `json:"key"` Routes []Route `json:"routes"` }
Registration is a registration message from an app to Harp enclosed in a WebSocket message
type Route ¶
type Route struct { Name string `json:"name"` Path string `json:"path"` RegExp string `json:"regexp"` Port int `json:"port"` Domain string `json:"domain"` IPorHost string `json:"ipOrHost"` Status Status `json:"-"` // We store the status of the route here Pattern *regexp.Regexp `json:"-"` // We store the compiled regular expression here Conn *websocket.Conn `json:"-"` // We store the WebSocket connection here //Handler func(*HTTPRequest) `json:"-"` // We store the handler here //Handler HandlerFunc `json:"-"` Handler http.HandlerFunc `json:"-"` }
Route is a route that Harp will proxy to the app
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a Harp server
func (*Server) HandleFunc ¶
func (s *Server) HandleFunc(path string, handler http.HandlerFunc)
HandleFunc registers a handler for the given path
func (*Server) ListenAndServe ¶
ListenAndServe listens on the TCP network address addr and then calls Serve
func (*Server) ListenAndServeWithAutoReconnect ¶
ListenAndServeWithAutoReconnect listens on the TCP network address addr and then calls Serve
Click to show internal directories.
Click to hide internal directories.