spamc

package module
v0.0.0-...-80c88cc Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MPL-2.0 Imports: 18 Imported by: 0

README

spamc

Golang Spamc Client

Build Status codecov Go Report Card GoDoc MPLv2 License

Description

spamc is a Golang library and cmdline tool that implements the SPAMC/SPAMD client protocol used by SpamAssassin.

Requirements

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

Getting started

Spamc client

The spamc client can be installed as follows

$ go get github.com/baruwa-enterprise/spamc/cmd/spamc

Or by cloning the repo and then running

$ make build
$ ./bin/spamc
Spamc library

To install the library

go get github.com/baruwa-enterprise/spamc

You can then import it in your code

import "github.com/baruwa-enterprise/spamc"
Testing

make test

License

MPL-2.0

Documentation

Overview

Package spamc Golang spamc client Spamc - Golang spamc 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 Spamc client.

func NewClient

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

NewClient returns a new Spamc client.

func (*Client) Check

func (c *Client) Check(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(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(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() (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(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(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(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(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(r io.Reader) (rs *response.Response, err error)

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

func (*Client) Tell

func (c *Client) Tell(r io.Reader, l request.MsgType, a request.TellAction) (rs *response.Response, err error)

Tell instructs the SPAMD service to to mark the message

Directories

Path Synopsis
cmd
spamc
Package main Spamc - Golang spamc client Package main Spamc - Golang spamc client
Package main Spamc - Golang spamc client Package main Spamc - Golang spamc client
Package main Spamc - Golang spamc client
Package main Spamc - Golang spamc client
Package header Golang spamc client Spamc - Golang spamc client
Package header Golang spamc client Spamc - Golang spamc client
Package request Golang spamc client Spamc - Golang spamc client
Package request Golang spamc client Spamc - Golang spamc client
Package response Golang spamc client Spamc - Golang spamc client
Package response Golang spamc client Spamc - Golang spamc client

Jump to

Keyboard shortcuts

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