Versions in this module Expand all Collapse all v1 v1.0.0 Sep 7, 2023 Changes in this version + var ErrNoSuchAddress = errors.New("no such address") + var ErrNoSuchLabel = errors.New("no such label") + var ErrNoSuchUser = errors.New("no such user") + type AuthCacher interface + GetAuth func(username string) (proton.Auth, bool) + GetAuthInfo func(username string) (proton.AuthInfo, bool) + SetAuth func(username string, auth proton.Auth) + SetAuthInfo func(username string, info proton.AuthInfo) + func NewAuthCache() AuthCacher + type Call struct + Duration time.Duration + Method string + RequestBody []byte + RequestHeader http.Header + ResponseBody []byte + ResponseHeader http.Header + Status int + Time time.Time + URL *url.URL + type HandlerFunc func(http.ResponseWriter, *http.Request) ([]byte, error) + type Option interface + func WithAuthCacher(cacher AuthCacher) Option + func WithDomain(domain string) Option + func WithListener(listener net.Listener) Option + func WithLogger(logger io.Writer) Option + func WithMessageDedup() Option + func WithProxyOrigin(origin string) Option + func WithProxyTransport(transport *http.Transport) Option + func WithRateLimit(limit int, window time.Duration) Option + func WithRateLimitAndCustomStatusCode(limit int, window time.Duration, code int) Option + func WithServerConfig(cfg *http.Server) Option + func WithTLS(tls bool) Option + type Server struct + func New(opts ...Option) *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) ChangeAddressType(userID, addrId string, addrType proton.AddressType) error + func (s *Server) Close() + func (s *Server) CreateAddress(userID, email string, password []byte) (string, error) + func (s *Server) CreateAddressAsUpdate(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) SetMaxUpdatesPerEvent(max int) + func (s *Server) SetMinAppVersion(minAppVersion *semver.Version) + func (s *Server) SetOffline(offline bool) + func (s *Server) UnlabelMessage(userID, msgID, labelID string) error + type StatusHook func(*http.Request) (int, bool)