ant

package module
v0.0.0-...-252b9f9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2015 License: MIT Imports: 26 Imported by: 0

README

ant

Group of ants on golang

Install
$ go get -u github.com/txthinking/ant

Contributing

  • Please create ant with your pull request on develop branch
  • Please contain test case
  • Thank you

License

Licensed under The MIT License

Documentation

Index

Constants

View Source
const AES_256_KEY_LENTH = 32
View Source
const MAILGUN_API_URL = "https://api.mailgun.net/v3"

Variables

This section is empty.

Functions

func AESDecrypt

func AESDecrypt(c string, key string) (s string, err error)

func AESEncrypt

func AESEncrypt(s string, key string) (c string, err error)

func AESMake256Key

func AESMake256Key(key string) (k []byte)

Cut or append empty data on the key. make the key length equal 32

func ChunkSplit

func ChunkSplit(s string) (r string, err error)

Chunk data using RFC 2045.

func IsBankCard

func IsBankCard(n int64) (ok bool, err error)

func IsChineseID

func IsChineseID(s string) (ok bool, err error)

func IsChineseWords

func IsChineseWords(words string) (ok bool, err error)

Notice: NOT ALL

func IsEmail

func IsEmail(email string) (ok bool, err error)

func MD5

func MD5(s string) (r string)

func MakeBoundary

func MakeBoundary() (b string)

Create boundary for MIME data.

func Markdown

func Markdown(markdown []byte) (html []byte)

func MultipartFormDataFromFile

func MultipartFormDataFromFile(params, files map[string][]string, boundary string) (ior io.Reader, err error)

RFC 2388

func MultipartFormDataFromReader

func MultipartFormDataFromReader(params map[string][]string, files map[string][]io.Reader, boundary string) (ior io.Reader, err error)

RFC 2388

func RandomNumber

func RandomNumber() (i int64)

func SHA1

func SHA1(s string) (r string)

Types

type CIDRInfo

type CIDRInfo struct {
	First   string
	Last    string
	Block   int64
	Network string
	Count   int64
}

func CIDR

func CIDR(cidr string) (c *CIDRInfo, err error)

wiki: http://goo.gl/AEUIi8

type Mailgun

type Mailgun struct {
	Domain string
	APIKey string
}

func (*Mailgun) Send

func (m *Mailgun) Send(msg *Message) (err error)

type Message

type Message struct {
	From    *mail.Address
	To      []*mail.Address
	Subject string
	Body    string
	Att     []string
}

func (*Message) Reader

func (m *Message) Reader() (r io.Reader, err error)

MIME RFC2045 https://en.wikipedia.org/wiki/MIME

func (*Message) String

func (m *Message) String() (data string, err error)

MIME RFC2045 https://en.wikipedia.org/wiki/MIME

type SMTP

type SMTP struct {
	Server   string
	Port     int
	UserName string
	Password string
	IsTLS    bool
}

func (*SMTP) Send

func (m *SMTP) Send(msg *Message) (err error)

RFC 821,822,1869,2821 from/to can be "some@domain.com" or RFC 5322 address, e.g. "Barry Gibbs <bg@example.com>" NOTICE: If the name is not ASCII, you should be do some encoding, eg:"=?utf-8?B?"+base64.StdEncoding.EncodeToString([]byte("名字"))+"?=" att is the file path for attachments or nil if no attachment.

type SafeMap

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

func NewSafeMap

func NewSafeMap() *SafeMap

func (*SafeMap) Delete

func (m *SafeMap) Delete(k interface{})

func (*SafeMap) Get

func (m *SafeMap) Get(k interface{}) interface{}

func (*SafeMap) IsExists

func (m *SafeMap) IsExists(k interface{}) bool

func (*SafeMap) Set

func (m *SafeMap) Set(k interface{}, v interface{}) bool

Jump to

Keyboard shortcuts

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