wire

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2025 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package wire includes constants and functions for the raw libmilter protocol

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendCString

func AppendCString(dest []byte, s string) []byte

AppendCString appends a C style string to the buffer and returns it (like append does). It is assumed that s does not contain null-bytes.

func AppendUint16

func AppendUint16(dest []byte, val uint16) []byte

AppendUint16 appends the big endian encoding of val to dest. It returns the new dest like append does.

func DecodeCStrings

func DecodeCStrings(data []byte) []string

DecodeCStrings splits a C style strings into a Go string slice The last C style string in data can optionally not be terminated with a null-byte.

func ReadCString

func ReadCString(data []byte) string

ReadCString reads and returns a C style string from []byte. If data does not contain a null-byte the whole data-slice is returned as string

func WritePacket

func WritePacket(conn net.Conn, msg *Message, timeout time.Duration) error

Types

type ActionCode

type ActionCode byte
const (
	ActAccept    ActionCode = 'a' // SMFIR_ACCEPT
	ActContinue  ActionCode = 'c' // SMFIR_CONTINUE
	ActDiscard   ActionCode = 'd' // SMFIR_DISCARD
	ActReject    ActionCode = 'r' // SMFIR_REJECT
	ActTempFail  ActionCode = 't' // SMFIR_TEMPFAIL
	ActReplyCode ActionCode = 'y' // SMFIR_REPLYCODE
	ActSkip      ActionCode = 's' // SMFIR_SKIP [v6]
	ActProgress  ActionCode = 'p' // SMFIR_PROGRESS [v6]
)

func (ActionCode) String added in v0.10.0

func (i ActionCode) String() string

type Code

type Code byte
const (
	CodeOptNeg      Code = 'O' // SMFIC_OPTNEG
	CodeMacro       Code = 'D' // SMFIC_MACRO
	CodeConn        Code = 'C' // SMFIC_CONNECT
	CodeQuit        Code = 'Q' // SMFIC_QUIT
	CodeHelo        Code = 'H' // SMFIC_HELO
	CodeMail        Code = 'M' // SMFIC_MAIL
	CodeRcpt        Code = 'R' // SMFIC_RCPT
	CodeHeader      Code = 'L' // SMFIC_HEADER
	CodeEOH         Code = 'N' // SMFIC_EOH
	CodeBody        Code = 'B' // SMFIC_BODY
	CodeEOB         Code = 'E' // SMFIC_BODYEOB
	CodeAbort       Code = 'A' // SMFIC_ABORT
	CodeData        Code = 'T' // SMFIC_DATA
	CodeQuitNewConn Code = 'K' // SMFIC_QUIT_NC [v6]
	CodeUnknown     Code = 'U' // SMFIC_UNKNOWN [v6]
)

func (Code) String added in v0.10.0

func (i Code) String() string

type Message

type Message struct {
	Code Code
	Data []byte
}

Message represents a command sent from milter client

func ReadPacket

func ReadPacket(conn net.Conn, timeout time.Duration) (*Message, error)

func (*Message) MacroCode added in v0.10.0

func (m *Message) MacroCode() Code

MacroCode returns the Code this CodeMacro message is about. If the message is not a CodeMacro message, it returns the Code itself.

type ModifyActCode

type ModifyActCode byte
const (
	ActAddRcpt      ModifyActCode = '+' // SMFIR_ADDRCPT
	ActDelRcpt      ModifyActCode = '-' // SMFIR_DELRCPT
	ActReplBody     ModifyActCode = 'b' // SMFIR_ACCEPT
	ActAddHeader    ModifyActCode = 'h' // SMFIR_ADDHEADER
	ActChangeHeader ModifyActCode = 'm' // SMFIR_CHGHEADER
	ActInsertHeader ModifyActCode = 'i' // SMFIR_INSHEADER
	ActQuarantine   ModifyActCode = 'q' // SMFIR_QUARANTINE
	ActChangeFrom   ModifyActCode = 'e' // SMFIR_CHGFROM [v6]
	ActAddRcptPar   ModifyActCode = '2' // SMFIR_ADDRCPT_PAR [v6]
)

func (ModifyActCode) String added in v0.10.0

func (i ModifyActCode) String() string

Jump to

Keyboard shortcuts

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