controller

package
v0.0.0-...-42cc326 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionController

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

SessionController handles all session related request

func NewSessionController

func NewSessionController(sessionDomain SessionDomain) *SessionController

NewSessionController returns a new session controller

func (*SessionController) Add

func (c *SessionController) Add(ctx echo.Context) error

Add handler POST /add

func (*SessionController) Get

func (c *SessionController) Get(ctx echo.Context) error

Get handler GET /:roomID

func (*SessionController) Index

func (c *SessionController) Index(ctx echo.Context) error

Index handler GET /

func (*SessionController) List

func (c *SessionController) List(ctx echo.Context) error

List handler GET /list

func (*SessionController) PrerenderTemplates

func (c *SessionController) PrerenderTemplates(server *echo.Echo, filePattern string) error

PrerenderTemplates prerenders all templates

func (*SessionController) RegisterRoutes

func (c *SessionController) RegisterRoutes(server *echo.Echo)

RegisterRoutes registers all controller routes at an echo framework instance.

func (*SessionController) Tunnel

func (c *SessionController) Tunnel(ctx echo.Context) error

Tunnel handler GET /tunnel

type SessionDomain

type SessionDomain interface {
	Add(request *domain.AddSessionRequest, ip net.IP) (*entity.Session, error)
	Get(roomID int32) (*entity.Session, error)
	List() ([]entity.Session, error)
	GetTunnel(tunnelName string) *domain.MitmInfo
	PurgeOld() error
}

SessionDomain interface to decouple the controller logic from the domain code.

type SessionsResponse

type SessionsResponse struct {
	Fields entity.Session `json:"fields"`
}

ListSessionsResponse is a custom DTO for backward compatability.

type Template

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

Template abspracts the template rendering.

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render implements the echo template rendering interface

Jump to

Keyboard shortcuts

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