tornote: github.com/osminogin/tornote Index | Files

package tornote

import "github.com/osminogin/tornote"

Index

Package Files

handlers.go middleware.go note.go server.go

func CreateNoteHandler Uses

func CreateNoteHandler(s *Server) http.Handler

CreateNoteHandler save secret note to persistent datastore and return note ID.

func HealthStatusHandler Uses

func HealthStatusHandler(w http.ResponseWriter, r *http.Request)

Return status for health checks.

func MainFormHandler Uses

func MainFormHandler(s *Server) http.Handler

MainFormHandler renders main form.

func PublicFileHandler Uses

func PublicFileHandler(w http.ResponseWriter, r *http.Request)

PublicFileHandler get file from bindata or return not found error.

func ReadNoteHandler Uses

func ReadNoteHandler(s *Server) http.Handler

ReadNoteHandler print encrypted data for client-side decrypt and destroy note.

func RedirectToHTTPSMiddleware Uses

func RedirectToHTTPSMiddleware(next http.Handler) http.Handler

type Note Uses

type Note struct {
    UUID uuid.UUID `json:"-" pg:",pk,type:uuid"`
    Data []byte    `json:"data"`
}

func (*Note) String Uses

func (n *Note) String() string

type Server Uses

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

func NewServer Uses

func NewServer(opts ServerOpts) *Server

Constructor for new Server.

func (*Server) Init Uses

func (s *Server) Init()

Initialize server.

func (*Server) Listen Uses

func (s *Server) Listen() error

Listen server on specified port with opened database connection.

type ServerOpts Uses

type ServerOpts struct {
    // Listen port
    Port uint64
    // Data source name
    DSN string
    // HTTPS only traffic allowed
    HTTPSOnly bool
    // Server Secret key
    Secret string
}

Package tornote imports 12 packages (graph). Updated 2020-09-22. Refresh now. Tools for package owners.