Documentation
¶
Index ¶
- Constants
- type CheckSubdomainExistsResponse
- type ContentType
- type EgressEvent
- type EgressMessage
- type Endpoint
- type EndpointController
- func (ec *EndpointController) Broadcast(endpoint string, req *HookRequest)
- func (ec *EndpointController) CheckSubdomainExistsHandler(c *fiber.Ctx) error
- func (ec *EndpointController) GenerateEndpointHandler(c *fiber.Ctx) error
- func (ec *EndpointController) GetEndpointHistoryHandler(c *fiber.Ctx) error
- func (ec *EndpointController) GetUserEndpointsHandler(c *fiber.Ctx) error
- func (ec *EndpointController) HookHandler(c *fiber.Ctx) error
- func (ec *EndpointController) InspectRequestsHandler(c *websocket.Conn)
- func (ec *EndpointController) RegisterRoutes(app *fiber.App, authmw, cache fiber.Handler)
- func (ec *EndpointController) RequestDetailsHandler(c *fiber.Ctx) error
- func (ec *EndpointController) RequestDetailsUUIDHandler(c *fiber.Ctx) error
- func (ec *EndpointController) StatsHandler(c *fiber.Ctx) error
- type EndpointError
- type EndpointExists
- type EndpointQuerier
- type EndpointService
- func (s *EndpointService) CheckEndpointExists(ctx context.Context, subdomain string) (EndpointExists, *EndpointError)
- func (s *EndpointService) CreateEndpoint(ctx context.Context, username string, subdomain string) (db.Endpoint, *EndpointError)
- func (s *EndpointService) ExpireRequests(ctx context.Context) error
- func (s *EndpointService) GetEndpointRequestHistory(ctx context.Context, endpoint string, userId int64, limit int32, offset int32) ([]HookRequest, *EndpointError)
- func (s *EndpointService) GetEndpointStats(ctx context.Context, endpoint string) (EndpointStats, *EndpointError)
- func (s *EndpointService) GetRequestByUUID(ctx context.Context, uuid string) (HookRequest, *EndpointError)
- func (s *EndpointService) GetRequestDetails(ctx context.Context, reqId int64) (HookRequest, *EndpointError)
- func (s *EndpointService) GetUserEndpoints(ctx context.Context, userId int64) ([]Endpoint, *EndpointError)
- func (s *EndpointService) StoreRequestDetails(ctx context.Context, hookReq HookRequest) (db.Request, *EndpointError)
- type EndpointSession
- type EndpointStats
- type EndpointStore
- func (us EndpointStore) CheckEndpointExists(ctx context.Context, endpoint string) (bool, error)
- func (us EndpointStore) CreateNewRequest(ctx context.Context, params db.CreateNewRequestParams) (db.Request, error)
- func (us EndpointStore) ExpireRequests(ctx context.Context) error
- func (us EndpointStore) GetEndpoint(ctx context.Context, endpoint string) (db.Endpoint, error)
- func (us EndpointStore) GetEndpointHistory(ctx context.Context, params db.GetEndpointHistoryParams) ([]db.GetEndpointHistoryRow, error)
- func (us EndpointStore) GetEndpointRequestCount(ctx context.Context, endpoint string) (db.GetEndpointRequestCountRow, error)
- func (us EndpointStore) GetNonExpiredEndpointsOfUser(ctx context.Context, userId pgtype.Int8) ([]db.Endpoint, error)
- func (us EndpointStore) GetRequestById(ctx context.Context, reqId int64) (db.Request, error)
- func (us EndpointStore) GetRequestByUUID(ctx context.Context, uuid string) (db.Request, error)
- func (us EndpointStore) GetUserEndpoints(ctx context.Context, userId int64) ([]db.Endpoint, error)
- func (us EndpointStore) InsertEndpoint(ctx context.Context, params db.InsertEndpointParams) (db.Endpoint, error)
- func (us EndpointStore) InsertFreeEndpoint(ctx context.Context, params db.InsertFreeEndpointParams) (db.Endpoint, error)
- type GenerateEndpointRequest
- type GenerateEndpointResponse
- type GetEndpointsHistoryResponse
- type GetUserEndpointsResponse
- type HookRequest
- type WSClient
- type WSManager
- type WSMessage
Constants ¶
View Source
const ( RandomEndpointLength int = 10 DefaultLimitNumUrl int = 1 DefaultExpiryHours int = 6 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentType ¶
type ContentType string
const ( ApplicationJson ContentType = "application/json" TextYaml ContentType = "text/yaml" FormUrlEncoded ContentType = "application/x-www-form-urlencoded" MultipartForm ContentType = "multipart/form-data" )
type EgressEvent ¶
type EgressEvent string
const ( Hook EgressEvent = "hook" Err EgressEvent = "err" )
type EgressMessage ¶
type EgressMessage struct { Type EgressEvent `json:"event"` Payload json.RawMessage `json:"payload"` }
type EndpointController ¶
type EndpointController struct {
// contains filtered or unexported fields
}
func NewEndpointController ¶
func NewEndpointController(service *EndpointService, wsManager *WSManager, pv *core.PasetoVerifier) *EndpointController
func (*EndpointController) Broadcast ¶
func (ec *EndpointController) Broadcast(endpoint string, req *HookRequest)
func (*EndpointController) CheckSubdomainExistsHandler ¶
func (ec *EndpointController) CheckSubdomainExistsHandler(c *fiber.Ctx) error
func (*EndpointController) GenerateEndpointHandler ¶
func (ec *EndpointController) GenerateEndpointHandler(c *fiber.Ctx) error
func (*EndpointController) GetEndpointHistoryHandler ¶
func (ec *EndpointController) GetEndpointHistoryHandler(c *fiber.Ctx) error
func (*EndpointController) GetUserEndpointsHandler ¶
func (ec *EndpointController) GetUserEndpointsHandler(c *fiber.Ctx) error
func (*EndpointController) HookHandler ¶
func (ec *EndpointController) HookHandler(c *fiber.Ctx) error
func (*EndpointController) InspectRequestsHandler ¶
func (ec *EndpointController) InspectRequestsHandler(c *websocket.Conn)
func (*EndpointController) RegisterRoutes ¶
func (ec *EndpointController) RegisterRoutes(app *fiber.App, authmw, cache fiber.Handler)
func (*EndpointController) RequestDetailsHandler ¶
func (ec *EndpointController) RequestDetailsHandler(c *fiber.Ctx) error
func (*EndpointController) RequestDetailsUUIDHandler ¶
func (ec *EndpointController) RequestDetailsUUIDHandler(c *fiber.Ctx) error
func (*EndpointController) StatsHandler ¶
func (ec *EndpointController) StatsHandler(c *fiber.Ctx) error
Returns status of a given endpoint
type EndpointError ¶
func NewInternalServerError ¶
func NewInternalServerError() *EndpointError
TODO: Convert this into checkpost custom error
func (*EndpointError) Error ¶
func (u *EndpointError) Error() string
type EndpointExists ¶
type EndpointExists string
const ( Available EndpointExists = "Its available. Sign up and make it yours" Taken EndpointExists = "That endpoint is already taken. Try something else?" ReservedCompany EndpointExists = "Endpoint is reserved. But, you can go ahead if you're using mail issued from that organisation." ReservedEndpoint EndpointExists = "Endpoint is reserved." BadEndpoint EndpointExists = "Bad endpoint." Error EndpointExists = "Something went wrong." )
type EndpointQuerier ¶
type EndpointQuerier interface { CheckEndpointExists(ctx context.Context, endpoint string) (bool, error) GetEndpointRequestCount(ctx context.Context, endpoint string) (db.GetEndpointRequestCountRow, error) GetEndpoint(ctx context.Context, endpoint string) (db.Endpoint, error) GetUserEndpoints(ctx context.Context, userId int64) ([]db.Endpoint, error) GetEndpointHistory(ctx context.Context, params db.GetEndpointHistoryParams) ([]db.GetEndpointHistoryRow, error) GetNonExpiredEndpointsOfUser(ctx context.Context, userId pgtype.Int8) ([]db.Endpoint, error) InsertFreeEndpoint(ctx context.Context, params db.InsertFreeEndpointParams) (db.Endpoint, error) InsertEndpoint(ctx context.Context, params db.InsertEndpointParams) (db.Endpoint, error) // TODO: Move these to requests querier CreateNewRequest(ctx context.Context, params db.CreateNewRequestParams) (db.Request, error) GetRequestById(ctx context.Context, reqId int64) (db.Request, error) GetRequestByUUID(ctx context.Context, uuid string) (db.Request, error) ExpireRequests(ctx context.Context) error }
type EndpointService ¶
type EndpointService struct {
// contains filtered or unexported fields
}
func NewEndpointService ¶
func NewEndpointService(endpointq EndpointQuerier, userq user.UserQuerier) *EndpointService
func (*EndpointService) CheckEndpointExists ¶
func (s *EndpointService) CheckEndpointExists(ctx context.Context, subdomain string) (EndpointExists, *EndpointError)
func (*EndpointService) CreateEndpoint ¶
func (s *EndpointService) CreateEndpoint(ctx context.Context, username string, subdomain string) (db.Endpoint, *EndpointError)
func (*EndpointService) ExpireRequests ¶
func (s *EndpointService) ExpireRequests(ctx context.Context) error
func (*EndpointService) GetEndpointRequestHistory ¶
func (s *EndpointService) GetEndpointRequestHistory(ctx context.Context, endpoint string, userId int64, limit int32, offset int32) ([]HookRequest, *EndpointError)
func (*EndpointService) GetEndpointStats ¶
func (s *EndpointService) GetEndpointStats(ctx context.Context, endpoint string) (EndpointStats, *EndpointError)
func (*EndpointService) GetRequestByUUID ¶
func (s *EndpointService) GetRequestByUUID(ctx context.Context, uuid string) (HookRequest, *EndpointError)
func (*EndpointService) GetRequestDetails ¶
func (s *EndpointService) GetRequestDetails(ctx context.Context, reqId int64) (HookRequest, *EndpointError)
func (*EndpointService) GetUserEndpoints ¶
func (s *EndpointService) GetUserEndpoints(ctx context.Context, userId int64) ([]Endpoint, *EndpointError)
func (*EndpointService) StoreRequestDetails ¶
func (s *EndpointService) StoreRequestDetails(ctx context.Context, hookReq HookRequest) (db.Request, *EndpointError)
type EndpointSession ¶
type EndpointStats ¶
type EndpointStore ¶
type EndpointStore struct {
// contains filtered or unexported fields
}
func NewEndpointStore ¶
func NewEndpointStore(q db.Querier) *EndpointStore
func (EndpointStore) CheckEndpointExists ¶
func (EndpointStore) CreateNewRequest ¶
func (us EndpointStore) CreateNewRequest(ctx context.Context, params db.CreateNewRequestParams) (db.Request, error)
TODO: Move this
func (EndpointStore) ExpireRequests ¶
func (us EndpointStore) ExpireRequests(ctx context.Context) error
func (EndpointStore) GetEndpoint ¶
func (EndpointStore) GetEndpointHistory ¶
func (us EndpointStore) GetEndpointHistory(ctx context.Context, params db.GetEndpointHistoryParams) ([]db.GetEndpointHistoryRow, error)
func (EndpointStore) GetEndpointRequestCount ¶
func (us EndpointStore) GetEndpointRequestCount(ctx context.Context, endpoint string) (db.GetEndpointRequestCountRow, error)
func (EndpointStore) GetNonExpiredEndpointsOfUser ¶
func (EndpointStore) GetRequestById ¶
func (EndpointStore) GetRequestByUUID ¶
func (EndpointStore) GetUserEndpoints ¶
func (EndpointStore) InsertEndpoint ¶
func (us EndpointStore) InsertEndpoint(ctx context.Context, params db.InsertEndpointParams) (db.Endpoint, error)
func (EndpointStore) InsertFreeEndpoint ¶
func (us EndpointStore) InsertFreeEndpoint(ctx context.Context, params db.InsertFreeEndpointParams) (db.Endpoint, error)
type GenerateEndpointRequest ¶
type GenerateEndpointRequest struct {
Endpoint string `json:"endpoint"`
}
type GetEndpointsHistoryResponse ¶
type GetEndpointsHistoryResponse struct {
Requests []HookRequest `json:"requests"`
}
type GetUserEndpointsResponse ¶
type GetUserEndpointsResponse struct {
Endpoints []Endpoint `json:"endpoints"`
}
type HookRequest ¶
type HookRequest struct { Endpoint string `json:"endpoint"` UUID string `json:"uuid"` Path string `json:"path"` Headers map[string][]string `json:"headers"` QueryParams map[string]string `json:"query_params"` FormData map[string][]string `json:"form_data"` Method string `json:"method"` SourceIp string `json:"source_ip"` Content string `json:"content"` ContentType string `json:"content_type"` ContentSize int32 `json:"content_size"` ResponseCode int32 `json:"response_code"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` }
Click to show internal directories.
Click to hide internal directories.