Documentation ¶
Overview ¶
Package communication contains the implementation for communication channels that itsyou.online can use to communicate with users.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMaxSMS indicates that the sms sending to this number is being rate limited ErrMaxSMS = errors.New("Reached the max amount of sms for this phone number, try again later") )
Functions ¶
func IsRussianMobileNumber ¶ added in v0.9.15
IsRussianMobileNumber checks if a phone number is a russian mobile. phone numbers need to be passed in E.164 format (leading '+”).
Types ¶
type DevEmailService ¶
type DevEmailService struct{}
DevEmailService is the implementation of an EmailService suitable for use in local development environments
type DevSMSService ¶
type DevSMSService struct { }
DevSMSService is a fake sms service that just logs the sms that should be send
type EmailService ¶
type EmailService interface {
Send(recipients []string, subject string, message string) (err error)
}
EmailService defines an email communication channel
type RateLimitedSMSService ¶ added in v1.0.0
type RateLimitedSMSService struct {
// contains filtered or unexported fields
}
RateLimitedSMSService wraps an SMS service and applies rate limiting based on the phone number
func (*RateLimitedSMSService) Send ¶ added in v1.0.0
func (s *RateLimitedSMSService) Send(phonenumber string, message string) (err error)
Send checksif the message can be send according to the rate limiting rules, and then deligates the acutal sender to the wrapped service. This uses a sliding window approach
type SMSService ¶
SMSService defines an sms communication channel
func NewRateLimitedSMSService ¶ added in v1.0.0
func NewRateLimitedSMSService(window int, maxSMS int, actualService SMSService) SMSService
NewRateLimitedSMSService rates limit an existing sms service to the defined rate
type SMSServiceProxySeparateRussia ¶ added in v0.9.15
type SMSServiceProxySeparateRussia struct { RussianSMSService SMSService DefaultSMSService SMSService }
SMSServiceProxySeparateRussia is an SMS communication channel that uses a separate provider for russian phone numbers
type SMTPEmailService ¶
type SMTPEmailService struct {
// contains filtered or unexported fields
}
SMTPEmailService implements an email service using plain old SMTP
func NewSMTPEmailService ¶
func NewSMTPEmailService(host string, port int, user string, password string) (service *SMTPEmailService)
NewSMTPEmailService creates a nes SMTPEmailService
type SmsAeroSMSService ¶ added in v0.9.15
SmsAeroSMSService is an SMS communication channel using smsaero
type TwilioSMSService ¶
TwilioSMSService is an SMS communication channel using Twilio