response

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package response Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client

Index

Constants

This section is empty.

Variables

View Source
var (
	// StatusCodes maps status code string to StatusCode
	StatusCodes = map[string]StatusCode{
		"EX_OK":          ExOK,
		"EX_USAGE":       ExUsage,
		"EX_DATAERR":     ExDataErr,
		"EX_NOINPUT":     ExNoInput,
		"EX_NOUSER":      ExNpUser,
		"EX_NOHOST":      ExNoHost,
		"EX_UNAVAILABLE": ExUnAvailable,
		"EX_SOFTWARE":    ExSoftware,
		"EX_OSERR":       ExOSErr,
		"EX_OSFILE":      ExOSFile,
		"EX_CANTCREAT":   ExCantCreat,
		"EX_IOERR":       ExIOErr,
		"EX_TEMPFAIL":    ExTempFail,
		"EX_PROTOCOL":    ExProtocol,
		"EX_NOPERM":      ExNoPerm,
		"EX_CONFIG":      ExConfig,
		"EX_TIMEOUT":     ExTimeout,
	}
)

Functions

This section is empty.

Types

type Msg

type Msg struct {
	Header textproto.MIMEHeader
	Body   []byte
}

A Msg represents a message response from a Spamd server.

func NewMsg

func NewMsg() *Msg

NewMsg returns a new Msg

type Response

type Response struct {
	RequestMethod request.Method
	StatusCode    StatusCode
	StatusMsg     string
	Version       string
	Score         float64
	BaseScore     float64
	IsSpam        bool
	Headers       textproto.MIMEHeader
	Msg           *Msg
	Raw           []byte
	Rules         []map[string]string
}

A Response represents a server response from a Spamd server.

func NewResponse

func NewResponse(m request.Method) *Response

NewResponse returns a new Response

type StatusCode

type StatusCode int

A StatusCode represents a SpamD server status code.

const (
	// ExOK => EX_OK
	ExOK StatusCode = 0
	// ExUsage => EX_USAGE
	ExUsage StatusCode = iota + 64
	// ExDataErr => EX_DATAERR
	ExDataErr
	// ExNoInput => EX_NOINPUT
	ExNoInput
	// ExNpUser => EX_NOUSER
	ExNpUser
	// ExNoHost => EX_NOHOST
	ExNoHost
	// ExUnAvailable => EX_UNAVAILABLE
	ExUnAvailable
	// ExSoftware => EX_SOFTWARE
	ExSoftware
	// ExOSErr => EX_OSERR
	ExOSErr
	// ExOSFile => EX_OSFILE
	ExOSFile
	// ExCantCreat => EX_CANTCREAT
	ExCantCreat
	// ExIOErr => EX_IOERR
	ExIOErr
	// ExTempFail => EX_TEMPFAIL
	ExTempFail
	// ExProtocol => EX_PROTOCOL
	ExProtocol
	// ExNoPerm => EX_NOPERM
	ExNoPerm
	// ExConfig => EX_CONFIG
	ExConfig
	// ExTimeout => EX_TIMEOUT
	ExTimeout
)

func (StatusCode) Error

func (s StatusCode) Error() (r string)

func (StatusCode) IsTemp

func (s StatusCode) IsTemp() (r bool)

IsTemp returns a bool indicating if the status is temporary.

func (StatusCode) String

func (s StatusCode) String() (r string)

Jump to

Keyboard shortcuts

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