spamd

package module
v0.0.0-...-5b5977b Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MPL-2.0 Imports: 19 Imported by: 0

README

spamd-client

Golang SpamAssassin Client Library and Commandline tool

Description

spamd-client is a Golang library and cmdline tool that implements the SPAMD client protocol used by SpamAssassin.

Requirements

  • Golang 1.20.x or higher
  • Pflag - github.com/spf13/pflag

Getting started

spamd-client client

The spamd-client client can be installed as follows

$ go get github.com/jniltinho/antispam/spamd/cmd/spamd-client

Or by cloning the repo and then running

$ make build
$ ./bin/spamd-client
spamd-client library

You can import the library in your code

import "github.com/jniltinho/antispam/spamd"
Testing

make test

Documentation

Overview

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

Index

Constants

View Source
const (
	// ClientVersion supported protocol version
	ClientVersion = "1.5"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client represents a Spamd-client.

func NewClient

func NewClient(network, address, user string, useCompression bool) (c *Client, err error)

NewClient returns a new Spamd-client.

func (*Client) Check

func (c *Client) Check(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Check requests the SPAMD service to check a message with a CHECK request.

func (*Client) DisableCompression

func (c *Client) DisableCompression()

DisableCompression disables compression

func (*Client) DisableRawBody

func (c *Client) DisableRawBody()

DisableRawBody enables returning the raw body

func (*Client) DisableTLS

func (c *Client) DisableTLS()

DisableTLS disables TLS

func (*Client) DisableTLSVerification

func (c *Client) DisableTLSVerification()

DisableTLSVerification disables verification of the server certificate

func (*Client) EnableCompression

func (c *Client) EnableCompression()

EnableCompression enables compression

func (*Client) EnableRawBody

func (c *Client) EnableRawBody()

EnableRawBody enables returning the raw body

func (*Client) EnableTLS

func (c *Client) EnableTLS()

EnableTLS enables TLS

func (*Client) EnableTLSVerification

func (c *Client) EnableTLSVerification()

EnableTLSVerification enables verification of the server certificate

func (*Client) Headers

func (c *Client) Headers(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Headers requests the SPAMD service to check a message with a HEADERS request.

func (*Client) Learn

func (c *Client) Learn(ctx context.Context, r io.Reader, l request.MsgType) (rs *response.Response, err error)

Learn instructs the SPAMD service to learn tokens from a message

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) (s bool, err error)

Ping sends a ping request to the SPAMD service and will receive a response if the service is alive.

func (*Client) Process

func (c *Client) Process(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Process requests the SPAMD service to check a message with a PROCESS request.

func (*Client) Report

func (c *Client) Report(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Report requests the SPAMD service to check a message with a REPORT request.

func (*Client) ReportIfSpam

func (c *Client) ReportIfSpam(ctx context.Context, r io.Reader) (rs *response.Response, err error)

ReportIfSpam requests the SPAMD service to check a message with a REPORT_IFSPAM request.

func (*Client) Revoke

func (c *Client) Revoke(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Revoke instructs the SPAMD service to revoke tokens from a message

func (*Client) SetCmdTimeout

func (c *Client) SetCmdTimeout(t time.Duration)

SetCmdTimeout sets the cmd timeout

func (*Client) SetConnRetries

func (c *Client) SetConnRetries(s int)

SetConnRetries sets the number of times connection is retried

func (*Client) SetConnSleep

func (c *Client) SetConnSleep(s time.Duration)

SetConnSleep sets the connection retry sleep duration in seconds

func (*Client) SetConnTimeout

func (c *Client) SetConnTimeout(t time.Duration)

SetConnTimeout sets the connection timeout

func (*Client) SetRootCA

func (c *Client) SetRootCA(p string) (err error)

SetRootCA sets the path to the RootCA file

func (*Client) SetUser

func (c *Client) SetUser(u string)

SetUser sets the user

func (*Client) Symbols

func (c *Client) Symbols(ctx context.Context, r io.Reader) (rs *response.Response, err error)

Symbols requests the SPAMD service to check a message with a SYMBOLS request.

func (*Client) Tell

Tell instructs the SPAMD service to to mark the message

Directories

Path Synopsis
cmd
spamd-client
Package main spamd-client - Golang Spamd SpamAssassin Client
Package main spamd-client - Golang Spamd SpamAssassin Client
Package main spamd-client - Golang Spamd SpamAssassin Client
Package main spamd-client - Golang Spamd SpamAssassin Client
Package header Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client
Package header Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client
Package request Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client
Package request Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client
Package response Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client
Package response Golang Spamd SpamAssassin Client spamd-client - Golang Spamd SpamAssassin Client

Jump to

Keyboard shortcuts

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