server

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ContextKeyEmail = &contextKey{"email"}
)

Functions

func GetFreePort

func GetFreePort() (int, error)

GetFreePort asks the kernel for a free open port that is ready to use.

func NewSSHServer

func NewSSHServer(SSHPort int, db *storage.DB, forwarder *Forwarder, emailer *ValTownEmail) *ssh.Server

Types

type AuthMiddleware

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

func NewAuthMiddleware

func NewAuthMiddleware(handler http.Handler, db *storage.DB) *AuthMiddleware

func (*AuthMiddleware) ServeHTTP

func (me *AuthMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Email

type Email struct {
	From    string `json:"from,omitempty"`
	To      string `json:"to,omitempty"`
	Cc      string `json:"cc,omitempty"`
	Bcc     string `json:"bcc,omitempty"`
	Subject string `json:"subject,omitempty"`
	Text    string `json:"text,omitempty"`
	Html    string `json:"html,omitempty"`
}

type ErrorPayload

type ErrorPayload struct {
	Message string
}

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

type Forwarder

type Forwarder struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Forwarder can be enabled by creating a Forwarder and adding the HandleSSHRequest callback to the server's RequestHandlers under tcpip-forward and cancel-tcpip-forward.

func NewForwarder

func NewForwarder(db *storage.DB) *Forwarder

func (*Forwarder) HandleSSHRequest

func (me *Forwarder) HandleSSHRequest(ctx ssh.Context, srv *ssh.Server, req *gossh.Request) (bool, []byte)

func (*Forwarder) SendRequest

func (me *Forwarder) SendRequest(user string, reqType string, payload []byte) (bool, []byte, error)

type ListAppsResponse

type ListAppsResponse struct {
	Apps []string
}

type LoginParams

type LoginParams struct {
	Email string
}

type LoginResponse

type LoginResponse struct {
	Username string
}

type RootHandler

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

func NewRootHandler

func NewRootHandler(db *storage.DB, forwarder *Forwarder) *RootHandler

func (*RootHandler) ServeHTTP

func (me *RootHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type SignupParams

type SignupParams struct {
	Email    string
	Username string
}

type SignupResponse

type SignupResponse struct {
	Username string
}

type SubdomainHandler

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

func NewSubdomainHandler

func NewSubdomainHandler(db *storage.DB, forwarder *Forwarder) *SubdomainHandler

func (*SubdomainHandler) ServeHTTP

func (me *SubdomainHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type UserResponse

type UserResponse struct {
	ID    string
	Name  string
	Email string
}

type ValTownEmail

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

func NewValTownEmail

func NewValTownEmail(token string) *ValTownEmail

func (*ValTownEmail) SendEmail

func (me *ValTownEmail) SendEmail(email Email) error

type VerifyEmailParams

type VerifyEmailParams struct {
	Code string
}

Directories

Path Synopsis
templ: version: v0.2.707
templ: version: v0.2.707

Jump to

Keyboard shortcuts

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