http

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Session = SessionManager{}
View Source
var WsChannels map[string]*websocket.Conn = make(map[string]*websocket.Conn)
View Source
var WsIds map[string]chan bool = make(map[string]chan bool)

Functions

func WriteWebsocketMessage

func WriteWebsocketMessage(mt int, id string, message []byte)

Types

type Gql

type Gql interface {
	GQLRender(w http.ResponseWriter, r *http.Request, sessionID string) (isErr bool)
	GQLRenderSubscription(mt int, message []byte, socketId string, sessionID string)
}

type Http

type Http struct {
	HttpPort   string   `json:"httpPort,omitempty"`
	HttpsPort  string   `json:"httpsPort,omitempty"`
	CookieName string   `json:"cookieName,omitempty"`
	Server     []server `json:"server,omitempty"`

	CheckOrigin func(url URL) (bool, interface{})
	OnBegin     func(url URL, httpPath *Path, originData interface{}, uid string) bool
	OnFinish    func(isErr bool, uid string)
	OnSession   func() (r interface{})
	// contains filtered or unexported fields
}

func Init

func Init(sytemlogs systemutils.Logs, configFile string) *Http

func (*Http) FrontEmbed added in v0.13.0

func (o *Http) FrontEmbed(filesystem embed.FS)

func (*Http) MatcherFunc

func (o *Http) MatcherFunc(hr *http.Request, hm *mux.RouteMatch) (r bool)

func (*Http) ServeHTTP

func (o *Http) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Http) SetGql

func (o *Http) SetGql(gql Gql) *Http

func (*Http) SetRest

func (o *Http) SetRest(rest Rest) *Http

func (*Http) Start

func (o *Http) Start()

func (*Http) WebSocketMessage

func (o *Http) WebSocketMessage(mt int, message []byte, id string, httpPath *Path, sessionID string)

type Path

type Path struct {
	Mode        string   `json:"mode,omitempty"`
	Path        string   `json:"path,omitempty"`
	Endpoint    string   `json:"endpoint,omitempty"`
	Rewrite     bool     `json:"rewrite,omitempty"`
	RewriteTo   string   `json:"rewriteTo,omitempty"`
	Redirect    Redirect `json:"redirect,omitempty"`
	FileDefault string   `json:"fileDefault,omitempty"`
	// contains filtered or unexported fields
}

type Redirect

type Redirect struct {
	From string `json:"from,omitempty"`
	To   string `json:"to,omitempty"`
}

type Rest

type Rest interface {
	RestRender(w http.ResponseWriter, r *http.Request, sessionID string) (isErr bool)
}

type SessionManager

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

func (*SessionManager) Destroy

func (o *SessionManager) Destroy()

func (*SessionManager) Get

func (o *SessionManager) Get() (r interface{}, err error)

func (*SessionManager) GetByID

func (o *SessionManager) GetByID(sessionID string) (r interface{}, err error)

func (*SessionManager) Init

func (o *SessionManager) Init(sessionName string, sessionLifetime int, w http.ResponseWriter, r *http.Request, sessionData interface{}) (id string, err error)

func (*SessionManager) Set

func (o *SessionManager) Set(sessionData interface{})

type URL

type URL struct {
	Scheme     string
	Port       string
	Host       string
	RequestURI string
	TLS        bool
	Method     string
	URL        string
	Referer    string
	Origin     struct {
		Scheme string
		Host   string
		Port   string
		URL    string
	}
}

func (*URL) Split

func (o *URL) Split(r *http.Request)

Jump to

Keyboard shortcuts

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