Example #1
0
// SetIPv4Addr sets the sender IPv4
func (r *Request) SetIPv4Addr(addr string) error {
	var stat C.SPF_errcode_t
	stat = C.SPF_request_set_ipv4_str(r.r, C.CString(addr))
	if stat != C.SPF_E_SUCCESS {
		return &spfError{stat}
	}
	return nil
}
Example #2
0
// SetIPAddr sets the IP address of the client (sending) MTA
func (r *request) setIpAddr(ip net.IP) error {
	var stat C.SPF_errcode_t
	cstring := C.CString(ip.String())
	defer C.free(unsafe.Pointer(cstring))
	if ip.To4() != nil {
		stat = C.SPF_request_set_ipv4_str(r.r, cstring)
	} else {
		stat = C.SPF_request_set_ipv6_str(r.r, cstring)
	}
	if stat != C.SPF_E_SUCCESS {
		return &spfError{stat}
	}
	return nil
}