Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(content string, orig []byte) (string, error)
- func Encrypt(content string, key string) (string, error)
- func GetNakedKey(cipher string) ([]byte, error)
- func InitDefaultDispatcher()
- func InitPrivKey()
- func NakedEncrypt(content string, orig []byte) (string, error)
- type Dispatcher
- type M
Constants ¶
View Source
const (
// AES-256
KeyLength = 32
)
Variables ¶
View Source
var ( ErrFailedToLogin = errors.New("failed to login") // returned by concrete client ErrInvalidData = errors.New("invalid data") // returned by concrete client ErrWrongType = errors.New("wrong session type") ErrTimeout = errors.New("subtask timeout") )
View Source
var (
ErrNoPrivateKeyFound = errors.New("no private key found")
)
View Source
var PullTimeout = 30 * time.Second
View Source
var PushTimeout = map[dispatcher.SubtaskType]time.Duration{ dispatcher.SubtaskLogin: 10 * time.Second, dispatcher.SubtaskList: 30 * time.Second, dispatcher.SubtaskElect: 5 * time.Second, }
Functions ¶
func GetNakedKey ¶
func InitDefaultDispatcher ¶
func InitDefaultDispatcher()
It's main's obligation to invoke this function.
func InitPrivKey ¶
func InitPrivKey()
This function could be called any times you want, explicitly or implicitly.
Types ¶
type Dispatcher ¶
type Dispatcher struct {
// contains filtered or unexported fields
}
var DefaultDispatcher *Dispatcher
func NewDispatcher ¶
func NewDispatcher(capacity int, avaliableHandlers []string) *Dispatcher
func (*Dispatcher) PushSubtask ¶
func (d *Dispatcher) PushSubtask(s *dispatcher.Subtask) <-chan *dispatcher.SubtaskResult
func (*Dispatcher) RunSubtask ¶
func (d *Dispatcher) RunSubtask(s *dispatcher.Subtask) *dispatcher.SubtaskResult
func (*Dispatcher) ServeHTTP ¶
func (d *Dispatcher) ServeHTTP(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.