Stable version of node-js port

This commit is contained in:
francis
2013-10-05 20:15:54 -03:00
parent f1aabc1313
commit b26972df79
6 changed files with 595 additions and 401 deletions

44
examples/report.go Normal file
View File

@@ -0,0 +1,44 @@
package main
import (
"fmt"
"go-spamc"
)
func main() {
html := "<html><title>Test</title><body>Hello world. I'm not a Spam, don't kill me spamassassin!</body></html>"
client := spamc.New("127.0.0.1:783", 10)
//the 2nd parameter is optional, you can set who (the unix user) do the call
//looks like client.Report(html, "saintienn")
reply, err := client.Report(html)
if err == nil {
fmt.Println(reply)
} else {
fmt.Println(reply, err)
}
}
/* Example Response
{
Code: 0,
Message: 'EX_OK',
Vars:{
isSpam: true,
spamScore: 6.9,
baseSpamScore: 5,
report:[
{
"score": score,
"symbol": x[1],
"message": message,
}
]
}
}
*/