File: example_test.go

package info (click to toggle)
golang-github-emersion-go-msgauth 0.6.6-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 256 kB
  • sloc: makefile: 2
file content (25 lines) | stat: -rw-r--r-- 485 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package authres_test

import (
	"log"

	"github.com/emersion/go-msgauth/authres"
)

func Example() {
	// Format
	results := []authres.Result{
		&authres.SPFResult{Value: authres.ResultPass, From: "example.net"},
		&authres.AuthResult{Value: authres.ResultPass, Auth: "sender@example.com"},
	}
	s := authres.Format("example.com", results)
	log.Println(s)

	// Parse
	identifier, results, err := authres.Parse(s)
	if err != nil {
		log.Fatal(err)
	}

	log.Println(identifier, results)
}