# PolicySet

The [PolicySet](https://pps-docs.pebcak.de/api/policyset) type represents all data provided by the postfix server in a typed and self-descriptive manner. Once your policy server receives data from postfix the data will be internally processed and as a result, a [PolicySet](https://pps-docs.pebcak.de/api/policyset) is created that is then provided as a pointer to the `Handle()` method of your [Handler](https://pps-docs.pebcak.de/api/handler) interface.

The [PolicySet](https://pps-docs.pebcak.de/api/policyset) currently consists of the following properties and follows the [Postfix documentation](http://www.postfix.org/SMTPD_POLICY_README.html). Please check the Postfix docs on details to the properties.

{% tabs %}
{% tab title="Signature" %}

```go
type PolicySet struct {
	// Postfix version 2.1 and later
	Request           string
	ProtocolState     string
	ProtocolName      string
	HELOName          string
	QueueId           string
	Sender            string
	Recipient         string
	RecipientCount    uint64
	ClientAddress     net.IP
	ClientName        string
	ReverseClientName string
	Instance          string

	// Postfix version 2.2 and later
	SASLMethod       string
	SASLUsername     string
	SASLSender       string
	Size             uint64
	CCertSubject     string
	CCertIssuer      string
	CCertFingerprint string

	// Postfix version 2.3 and later
	EncryptionProtocol string
	EncryptionCipher   string
	EncryptionKeysize  uint64
	ETRNDomain         string

	// Postfix version 2.5 and later
	Stress bool

	// Postfix version 2.9 and later
	CCertPubkeyFingerprint string

	// Postfix version 3.0 and later
	ClientPort uint64

	// Postfix version 3.1 and later
	PolicyContext string

	// Postfix version 3.2 and later
	ServerAddress net.IP
	ServerPort    uint64

	// postfix-policy-server specific values
	PPSConnId string
}
```

{% endtab %}
{% endtabs %}

Besides of all values provided by the Postfix server, **pps** adds some package specific values, that might be useful in your program. The list of pps-specific values currently is:

| Property  | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| --------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| PPSConnId | `string` | <p>Each time Postfix connects to your policy <br>service, a unique connection id is assigned</p><p>to it. The <code>PPSConnId</code> property represents</p><p>this <code>string</code>.</p><p></p><p><strong>Note: Please keep in mind, that the Postfix</strong> </p><p><strong>specifications require that a connection</strong> </p><p><strong>can be re-used by Postfix. Therefore you</strong></p><p><strong>might see multiple PolicySets with the</strong> </p><p><strong>same connection id.</strong></p> |
