-
Notifications
You must be signed in to change notification settings - Fork 0
/
dkim.go
39 lines (33 loc) · 1.34 KB
/
dkim.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2019, Shulhan <ms@kilabit.info>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dkim
import (
"errors"
)
// DefaultNameServers contains list of nameserver's IP addresses.
//
// If its not empty, the public key lookup using DNS/TXT will use this values;
// otherwise it will try to use the system name servers.
var DefaultNameServers []string
// DefaultKeyPool contains cached DKIM key.
//
// Implementor of this library can use the KeyPool.Get method to retrieve key
// instead of LookupKey to minimize network traffic and process to decode and
// parse public key.
var (
DefaultKeyPool = &KeyPool{
pool: make(map[string]*Key),
}
sepColon = []byte{':'}
sepSlash = []byte{'/'}
sepVBar = []byte{'|'}
errEmptySignAlg = errors.New("dkim: tag algorithm 'a=' is empty")
errEmptySDID = errors.New("dkim: tag SDID 'd=' is empty")
errEmptySelector = errors.New("dkim: tag selector 's=' is empty")
errEmptyHeader = errors.New("dkim: tag header 'h=' is empty")
errEmptyBodyHash = errors.New("dkim: tag body hash 'bh=' is empty")
errEmptySignature = errors.New("dkim: tag signature 'h=' is empty")
errFromHeader = errors.New("dkim: 'From' field is not in header tag")
errCreatedTime = errors.New("dkim: invalid expiration/creation time")
)