provider

package
v1.11.344 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DemoEmail = func() Email {
	payload := EmailPayload(fmt.Sprintf(`Date: %s
To: recipient@example.com
From: aws-ses-pop3-server <sender@example.com>
Subject: aws-ses-pop3-server

Hello,

You received this message because you successfully set up aws-ses-pop3-server.`, time.Now().Format("Mon, 02 Jan 2006 15:04:05 -0700")))
	hash := sha1.New()
	hash.Write(payload)
	sha := hash.Sum(nil)
	return Email{
		ID:      hex.EncodeToString(sha),
		Size:    int64(len(payload)),
		Payload: &payload,
	}
}()

Functions

func GetSortedMailNumbers added in v1.3.3

func GetSortedMailNumbers(emails map[int]*Email) []int

Types

type Email

type Email struct {
	ID      string
	Size    int64
	Payload *EmailPayload
}

type EmailPayload

type EmailPayload []byte

func (EmailPayload) ParseAll

func (payload EmailPayload) ParseAll() (lines []string, err error)

func (EmailPayload) ParseHeaders

func (payload EmailPayload) ParseHeaders(x int) (lines []string, err error)

type JWTClaims added in v1.6.0

type JWTClaims struct {
	jwt.StandardClaims
	Provider string `json:"provider,omitempty"`
	S3Bucket
}

type Provider

type Provider interface {
	ListEmails(notNumbers []int) (emails map[int]*Email, err error)
	GetEmail(number int, notNumbers []int) (email *Email, err error)
	GetEmailPayload(number int, notNumbers []int) (payload EmailPayload, err error)
	DeleteEmail(number int) (err error)
}

type ProviderCreator

type ProviderCreator func(user, password string) (Provider, error)

func NewHTTPBasicAuthProviderCreator added in v1.7.0

func NewHTTPBasicAuthProviderCreator(timeout time.Duration, url string) ProviderCreator

func NewJWTProviderCreator added in v1.6.0

func NewJWTProviderCreator(jwtSecret string) ProviderCreator

func NewStaticCredentialsProviderCreator added in v1.6.0

func NewStaticCredentialsProviderCreator(staticCreds StaticCredentials) ProviderCreator

type S3Bucket added in v1.6.0

type S3Bucket struct {
	AWSAccessKeyID     string `json:"awsAccessKeyID,omitempty"`
	AWSSecretAccessKey string `json:"awsSecretAccessKey,omitempty"`
	AWSSessionToken    string `json:"awsSessionToken,omitempty"`
	Region             string `json:"region,omitempty"`
	Bucket             string `json:"bucket,omitempty"`
	Prefix             string `json:"prefix,omitempty"`
}

type StaticCredentials added in v1.6.0

type StaticCredentials struct {
	User     string
	Password string
	S3Bucket *S3Bucket
}

Jump to

Keyboard shortcuts

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