utils

package
v0.0.0-...-fc91ca8 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProxiedFromDeviceHeader = "proxied-from-device"
)

Variables

This section is empty.

Functions

func CheckSameOrAllowedOrigin

func CheckSameOrAllowedOrigin(r *http.Request, validOrigins []url.URL) bool

From https://github.com/gorilla/websocket

func DeviceApplicationStatusesListToMap

func DeviceApplicationStatusesListToMap(deviceApplicationStatuses []models.DeviceApplicationStatus) (map[string]map[string]*models.DeviceApplicationStatus, error)

map[DeviceID]map[ApplicationID]*Status

func DeviceServiceStatesListToMap

func DeviceServiceStatesListToMap(deviceServiceStates []models.DeviceServiceState) (map[string]map[string]map[string]*models.DeviceServiceState, error)

map[DeviceID]map[ApplicationID]map[Service]*State

func EqualASCIIFold

func EqualASCIIFold(s, t string) bool

From https://github.com/gorilla/websocket EqualASCIIFold returns true if s is equal to t with ASCII case folding as defined in RFC 4790.

func GetDomainFromEmail

func GetDomainFromEmail(email string) (string, error)

func GetReleaseByIdentifier

func GetReleaseByIdentifier(rstore store.Releases, ctx context.Context, projectID, applicationID, releaseID string) (*models.Release, error)

func JSONConvert

func JSONConvert(src, target interface{}) error

func ProxyResponse

func ProxyResponse(w http.ResponseWriter, resp *http.Response)

func ProxyResponseFromDevice

func ProxyResponseFromDevice(w http.ResponseWriter, resp *http.Response)

func ReleasesListToMap

func ReleasesListToMap(releases []models.Release) (map[string]*models.Release, error)

map[ApplicationID]*Release

func ReplaceAllStringSubmatchFunc

func ReplaceAllStringSubmatchFunc(re *regexp.Regexp, str string, repl func([]string) string) string

Elliot Chance's github gist: https://gist.github.com/elliotchance/d419395aa776d632d897

func Respond

func Respond(w http.ResponseWriter, ret interface{})

func WithReferrer

func WithReferrer(w http.ResponseWriter, r *http.Request, f func(referrer *url.URL))

func WithTags

func WithTags(tags []string, items TagItems) []string

Types

type ResponseWriter

type ResponseWriter struct {
	HasWrittenStatus bool

	Headers http.Header
	Writer  io.Writer
	Status  int
}

func (*ResponseWriter) Header

func (w *ResponseWriter) Header() http.Header

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(b []byte) (n int, err error)

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(code int)

type TagItems

type TagItems struct {
	Project     *models.Project
	Device      *models.Device
	Application *models.Application
}

Jump to

Keyboard shortcuts

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