endpoints

package
v0.0.0-...-be0919c Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2018 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRouteForStop

func AddRouteForStop(router *httprouter.Router, stop ApplicationStopper)

AddRouteForStop adds stop route to given router

func AddRoutesForConnection

func AddRoutesForConnection(router *httprouter.Router, manager connection.Manager, ipResolver ip.Resolver,
	statsKeeper stats.SessionStatsKeeper)

AddRoutesForConnection adds connections routes to given router

func AddRoutesForIdentities

func AddRoutesForIdentities(
	router *httprouter.Router,
	idm identity.Manager,
	mystClient server.Client,
	signerFactory identity.SignerFactory,
)

AddRoutesForIdentities creates /identities endpoint on tequilapi service

func AddRoutesForLocation

func AddRoutesForLocation(router *httprouter.Router, manager connection.Manager,
	locationDetector location.Detector, locationCache location.Cache)

AddRoutesForLocation adds location routes to given router

func AddRoutesForProposals

func AddRoutesForProposals(router *httprouter.Router, mc server.Client)

AddRoutesForProposals attaches proposals endpoints to router

func HealthCheckEndpointFactory

func HealthCheckEndpointFactory(currentTimeFunc func() time.Time, procID func() int) *healthCheckEndpoint

HealthCheckEndpointFactory creates a structure with single HealthCheck method for healthcheck serving as http, currentTimeFunc is injected for easier testing

func NewIdentitiesEndpoint

func NewIdentitiesEndpoint(idm identity.Manager, mystClient server.Client, signerFactory identity.SignerFactory) *identitiesAPI

NewIdentitiesEndpoint creates identities api controller used by tequilapi service

func NewProposalsEndpoint

func NewProposalsEndpoint(mc server.Client) *proposalsEndpoint

NewProposalsEndpoint creates and returns proposal creation endpoint

Types

type ApplicationStopper

type ApplicationStopper func()

ApplicationStopper stops application and performs required cleanup tasks

type ConnectOptions

type ConnectOptions struct {
	// kill switch option restricting communication only through VPN
	// required: false
	// example: true
	DisableKillSwitch bool `json:"killSwitch"`
}

ConnectOptions holds tequilapi connect options swagger:model ConnectOptionsDTO

type ConnectionEndpoint

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

ConnectionEndpoint struct represents /connection resource and it's subresources

func NewConnectionEndpoint

func NewConnectionEndpoint(manager connection.Manager, ipResolver ip.Resolver, statsKeeper stats.SessionStatsKeeper) *ConnectionEndpoint

NewConnectionEndpoint creates and returns connection endpoint

func (*ConnectionEndpoint) Create

func (ce *ConnectionEndpoint) Create(resp http.ResponseWriter, req *http.Request, params httprouter.Params)

Create starts new connection swagger:operation PUT /connection Connection createConnection --- summary: Starts new connection description: Consumer opens connection to provider parameters:

  • in: body name: body description: Parameters in body (consumerId, providerId) required for creating new connection schema: $ref: "#/definitions/ConnectionRequestDTO"

responses:

201:
  description: Connection started
  schema:
    "$ref": "#/definitions/ConnectionStatusDTO"
400:
  description: Bad request
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
409:
  description: Conflict. Connection already exists
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
422:
  description: Parameters validation error
  schema:
    "$ref": "#/definitions/ValidationErrorDTO"
499:
  description: Connection was cancelled
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

func (*ConnectionEndpoint) GetIP

func (ce *ConnectionEndpoint) GetIP(writer http.ResponseWriter, request *http.Request, params httprouter.Params)

GetIP responds with current ip, using its ip resolver swagger:operation GET /connection/ip Location getIP --- summary: Returns IP address description: Returns current public IP address responses:

200:
  description: Public IP address
  schema:
    "$ref": "#/definitions/IPDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
503:
  description: Service unavailable
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

func (*ConnectionEndpoint) GetStatistics

func (ce *ConnectionEndpoint) GetStatistics(writer http.ResponseWriter, request *http.Request, params httprouter.Params)

GetStatistics returns statistics about current connection swagger:operation GET /connection/statistics Connection getStatistics --- summary: Returns connection statistics description: Returns statistics about current connection responses:

200:
  description: Connection statistics
  schema:
    "$ref": "#/definitions/ConnectionStatisticsDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

func (*ConnectionEndpoint) Kill

func (ce *ConnectionEndpoint) Kill(resp http.ResponseWriter, req *http.Request, params httprouter.Params)

Kill stops connection swagger:operation DELETE /connection Connection killConnection --- summary: Stops connection description: Stops current connection responses:

202:
  description: Connection Stopped
409:
  description: Conflict. No connection exists
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

func (*ConnectionEndpoint) Status

Status returns status of connection swagger:operation GET /connection Connection connectionStatus --- summary: Returns connection status description: Returns status of current connection responses:

200:
  description: Status
  schema:
    "$ref": "#/definitions/ConnectionStatusDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

type LocationEndpoint

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

LocationEndpoint struct represents /location resource and it's subresources

func NewLocationEndpoint

func NewLocationEndpoint(manager connection.Manager, locationDetector location.Detector,
	originalLocationCache location.Cache) *LocationEndpoint

NewLocationEndpoint creates and returns location endpoint

func (*LocationEndpoint) GetLocation

func (le *LocationEndpoint) GetLocation(writer http.ResponseWriter, request *http.Request, params httprouter.Params)

GetLocation responds with original and current locations swagger:operation GET /location Location getLocation --- summary: Returns location description: Returns original and current locations responses:

200:
  description: Original and current locations
  schema:
    "$ref": "#/definitions/LocationDTO"
500:
  description: Internal server error
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"
503:
  description: Service unavailable
  schema:
    "$ref": "#/definitions/ErrorMessageDTO"

Jump to

Keyboard shortcuts

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