Documentation
¶
Index ¶
- Variables
- type AuthCacher
- type Call
- type HandlerFunc
- type Option
- func WithAuthCacher(cacher AuthCacher) Option
- func WithDomain(domain string) Option
- func WithListener(listener net.Listener) Option
- func WithLogger(logger io.Writer) Option
- func WithProxyOrigin(origin string) Option
- func WithProxyTransport(transport *http.Transport) Option
- func WithRateLimit(limit int, window time.Duration) Option
- func WithServerConfig(cfg *http.Server) Option
- func WithTLS(tls bool) Option
- type Server
- func (s *Server) AddAddressCreatedEvent(userID, addrID string) error
- func (s *Server) AddCallWatcher(fn func(Call), paths ...string)
- func (s *Server) AddLabelCreatedEvent(userID, labelID string) error
- func (s *Server) AddMessageCreatedEvent(userID, messageID string) error
- func (s *Server) AddStatusHook(fn StatusHook)
- func (s *Server) Close()
- func (s *Server) CreateAddress(userID, email string, password []byte) (string, error)
- func (s *Server) CreateAddressKey(userID, addrID string, password []byte) error
- func (s *Server) CreateLabel(userID, name, parentID string, labelType proton.LabelType) (string, error)
- func (s *Server) CreateUser(username string, password []byte) (string, string, error)
- func (s *Server) CreateUserKey(userID string, password []byte) error
- func (s *Server) GetDomain() string
- func (s *Server) GetHostURL() string
- func (s *Server) GetLabels(userID string) ([]proton.Label, error)
- func (s *Server) GetProxyURL() string
- func (s *Server) GetUserKeyIDs(userID string) ([]string, error)
- func (s *Server) LabelMessage(userID, msgID, labelID string) error
- func (s *Server) RefreshUser(userID string, refresh proton.RefreshFlag) error
- func (s *Server) RemoveAddress(userID, addrID string) error
- func (s *Server) RemoveAddressKey(userID, addrID, keyID string) error
- func (s *Server) RemoveUser(userID string) error
- func (s *Server) RemoveUserKey(userID, keyID string) error
- func (s *Server) RevokeUser(userID string) error
- func (s *Server) SetAuthLife(authLife time.Duration)
- func (s *Server) SetMinAppVersion(minAppVersion *semver.Version)
- func (s *Server) SetOffline(offline bool)
- func (s *Server) UnlabelMessage(userID, msgID, labelID string) error
- type StatusHook
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthCacher ¶
type AuthCacher interface { GetAuthInfo(username string) (proton.AuthInfo, bool) SetAuthInfo(username string, info proton.AuthInfo) GetAuth(username string) (proton.Auth, bool) SetAuth(username string, auth proton.Auth) }
func NewAuthCache ¶
func NewAuthCache() AuthCacher
type HandlerFunc ¶
type Option ¶
type Option interface {
// contains filtered or unexported methods
}
Option represents a type that can be used to configure the server.
func WithAuthCacher ¶
func WithAuthCacher(cacher AuthCacher) Option
func WithDomain ¶ added in v0.2.2
withDomain controls the domain of the server.
func WithListener ¶ added in v0.4.0
WithListener allows you to set the net.Listener to use.
func WithProxyOrigin ¶
func WithProxyTransport ¶ added in v0.2.2
func WithServerConfig ¶ added in v0.4.0
WithServerConfig allows you to configure the underlying HTTP server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) AddAddressCreatedEvent ¶ added in v0.4.0
func (*Server) AddCallWatcher ¶
AddCallWatcher adds a call watcher to the server.
func (*Server) AddLabelCreatedEvent ¶ added in v0.4.0
func (*Server) AddMessageCreatedEvent ¶ added in v0.4.0
func (*Server) AddStatusHook ¶ added in v0.4.0
func (s *Server) AddStatusHook(fn StatusHook)
AddStatusHook adds a status hook to the server.
func (*Server) CreateAddress ¶
func (*Server) CreateAddressKey ¶
func (*Server) CreateLabel ¶
func (*Server) CreateUser ¶
CreateUser creates a new server user with the given username and password. A single address will be created for the user, derived from the username and the server's domain.
func (*Server) GetDomain ¶ added in v0.2.2
GetDomain returns the domain of the server (e.g. "proton.local").
func (*Server) GetHostURL ¶
GetHostURL returns the API root to make calls to.
func (*Server) GetProxyURL ¶
GetProxyURL returns the API root to make calls to which should be proxied.
func (*Server) LabelMessage ¶
func (*Server) RefreshUser ¶
func (*Server) RemoveAddress ¶
func (*Server) RemoveAddressKey ¶
func (*Server) RemoveUser ¶
func (*Server) RemoveUserKey ¶
func (*Server) RevokeUser ¶
func (*Server) SetAuthLife ¶
func (*Server) SetMinAppVersion ¶
func (s *Server) SetMinAppVersion(minAppVersion *semver.Version)