server

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: AGPL-3.0-or-later Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Iss *url.URL

	Logger logrus.FieldLogger

	OnReady  func(*Server)
	OnStatus func(*Server)

	APIBaseURI *url.URL

	Domains              []string
	PreferredDomainBases []string

	DAgentListenAddress string

	SMTPLocalAddr string

	StatePath string

	LicensesPath string
}

Config bundles configuration settings.

type DomainsClaims

type DomainsClaims struct {
	Domains []string `json:"domains"`
	// contains filtered or unexported fields
}

type Route added in v0.0.4

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

func (*Route) Data added in v0.0.4

func (route *Route) Data(ctx context.Context, reader io.Reader) error

func (*Route) Mail added in v0.0.4

func (route *Route) Mail(ctx context.Context, from string, opts smtp.MailOptions) error

func (*Route) Rcpt added in v0.0.4

func (route *Route) Rcpt(ctx context.Context, rcptTo string) error

type RouteMeta

type RouteMeta struct {
	Domain string           `json:"domain"`
	ID     string           `json:"id"`
	Expiry *jwt.NumericDate `json:"exp"`
}

type RouteStatus

type RouteStatus struct {
	Success bool `json:"success"`

	Code         int               `json:"code"`
	EnhancedCode smtp.EnhancedCode `json:"enhanced_code,omitempty"`
	Message      string            `json:"message"`
}

type Server

type Server struct {
	DAgent *dagent.DAgent
	// contains filtered or unexported fields
}

Server is our HTTP server implementation.

func NewServer

func NewServer(c *Config) (*Server, error)

NewServer constructs a server from the provided parameters.

func (*Server) GetRoute added in v0.0.4

func (server *Server) GetRoute(domain string) (dagent.Route, error)

func (*Server) Logger added in v0.1.0

func (server *Server) Logger() logrus.FieldLogger

func (*Server) Mail added in v0.0.4

func (server *Server) Mail(from string, opts smtp.MailOptions) error

func (*Server) Serve

func (server *Server) Serve(ctx context.Context) error

Serve starts all the accociated servers resources and listeners and blocks forever until signals or error occurs.

func (*Server) Status added in v0.1.0

func (server *Server) Status() (*Status, error)

type Status added in v0.1.0

type Status struct {
	sync.RWMutex

	HTTPProviderURL string   `json:"provider_url"`
	HTTPConnected   bool     `json:"provider_connected"`
	HTTPLicenseLIDs []string `json:"provider_license_ids"`

	SessionID  *string    `json:"session_id"`
	Domains    []string   `json:"domains"`
	Expiration *time.Time `json:"exp"`
}

func (*Status) Copy added in v0.1.0

func (status *Status) Copy() (*Status, error)

func (*Status) SetDomainsClaims added in v0.1.0

func (status *Status) SetDomainsClaims(domainsClaims *DomainsClaims) error

func (*Status) SetLicenseClaims added in v0.2.0

func (status *Status) SetLicenseClaims(licenseClaims []*license.Claims) error

type TextEvent

type TextEvent struct {
	Event string
	ID    string
	Data  string
}

Directories

Path Synopsis
smtp

Jump to

Keyboard shortcuts

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