server

package
v0.0.0-...-40a40b1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package server aes

Package server config

Package server svr

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesDecryptToken

func AesDecryptToken(token, passphrase string) (string, error)

AesDecryptToken AesDecryptToken

func AesEncryptToken

func AesEncryptToken(plainText, passphrase string) (string, error)

AesEncryptToken AesEncryptToken

func AesRandomKey

func AesRandomKey() string

AesRandomKey AesRandomKey

func Cors

func Cors() gin.HandlerFunc

Cors Cors

func RandString

func RandString(len int) string

RandString RandString

func SendMail

func SendMail(host string, port int, account string, pwd string, to []string, cc []string, subject string, body string) (err error)

SendMail to []addr

func SendMailByAccount

func SendMailByAccount(account *MailAccount, to []string, cc []string, subject string, body string) error

SendMailByAccount by account

Types

type Config

type Config struct {
	Listen   string // :27899
	BasePath string // api = http://{{listen}}/{{BasePath}}/mailto

	Accounts     []*MailAccount
	SubjectPrefx string

	Addrs []string

	TokenKey string
}

Config api config

type JSONResult

type JSONResult struct {
	Code int    `json:"code"` //0 true,
	Msg  string `json:"msg"`
}

JSONResult JSONResult

type MailAccount

type MailAccount struct {
	SMTP     string //smtp.mail.com:25
	User     string
	Password string
	Max      int //max send per day

	TodayCount   int //
	LastSendTime time.Time
	// contains filtered or unexported fields
}

MailAccount smtp account

type Server

type Server struct {
	Cfg    *Config
	GinEg  *gin.Engine
	Locker *sync.Mutex
	// contains filtered or unexported fields
}

Server send mail

func NewServer

func NewServer(cfg *Config) (svr *Server, err error)

NewServer make new

func (*Server) HandleMailTo

func (svr *Server) HandleMailTo(c *gin.Context)

HandleMailTo MailTo

func (*Server) InitRouter

func (svr *Server) InitRouter()

InitRouter InitRouter

func (*Server) SendTo

func (svr *Server) SendTo(to []string, cc []string, subject string, body string) (err error)

SendTo mail

func (*Server) Start

func (svr *Server) Start()

Start server

Jump to

Keyboard shortcuts

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