Documentation ¶
Overview ¶
diyi sms (http://www.1xinxi.cn/) Admin (http://sms.1xinxi.cn/)
Index ¶
- Constants
- func AddConfigNode(group string, node ConfigNode)
- func AddDefaultConfigGroup(nodes ConfigGroup)
- func AddDefaultConfigNode(node ConfigNode)
- func GetDefaultGroup() string
- func Register(name string, driver Driver) error
- func SetConfig(config Config)
- func SetConfigGroup(group string, nodes ConfigGroup)
- func SetDefaultGroup(name string)
- type Config
- type ConfigAliyun
- type ConfigDiyi
- type ConfigGroup
- type ConfigNode
- type Core
- type Driver
- type DriverAliyun
- type DriverDiyi
- type SMS
Constants ¶
const (
DEFAULT_GROUP_NAME = "default" // default config group name
)
const (
DIYI_SMS_SERVICE_URL = "http://sms.1xinxi.cn/asmx/smsservice.aspx?"
)
Variables ¶
This section is empty.
Functions ¶
func AddConfigNode ¶
func AddConfigNode(group string, node ConfigNode)
AddConfigNode adds one node configuration to configuration of given group.
func AddDefaultConfigGroup ¶
func AddDefaultConfigGroup(nodes ConfigGroup)
AddDefaultConfigGroup adds multiple node configurations to configuration of default group.
func AddDefaultConfigNode ¶
func AddDefaultConfigNode(node ConfigNode)
AddDefaultConfigNode adds one node configuration to configuration of default group.
func GetDefaultGroup ¶
func GetDefaultGroup() string
GetDefaultGroup returns the { name of default configuration.
func SetConfig ¶
func SetConfig(config Config)
SetConfig sets the global configuration for sms. It will overwrite the old configuration of sms config
func SetConfigGroup ¶
func SetConfigGroup(group string, nodes ConfigGroup)
SetConfigGroup sets the configuration for given group.
func SetDefaultGroup ¶
func SetDefaultGroup(name string)
SetDefaultGroup sets the group name for default configuration.
Types ¶
type ConfigAliyun ¶
type ConfigAliyun struct { AccessKeyId string // accesskey id AccessSecret string // access secret Sign string //signname }
ConfigAliyun aliyun sms config
type ConfigDiyi ¶
ConfigDiyi diyi config
type ConfigGroup ¶
type ConfigGroup []ConfigNode
ConfigGroup is a alice of configuration node for specifile named group.
func GetConfig ¶
func GetConfig(group string) ConfigGroup
GetConfig retrieves and returns the configuration of given group.
type ConfigNode ¶
type ConfigNode struct { // mu sync.RWMutex Driver string // sms driver Weight int // weight for load balance Path string // template toml files storage path Config *gmap.StrAnyMap // dirver config Data *gmap.StrStrMap // template data }
ConfigNode is configuration for one node.
type Core ¶
type Core struct { SMS SMS // SMS interface object. // contains filtered or unexported fields }
Core is the base struct for sms management
func (*Core) LoadTemplateFileToData ¶
func (c *Core) LoadTemplateFileToData(node *ConfigNode) error
LoadTemplateFileToData is only load once.
type Driver ¶
type Driver interface { New(core *Core, node *ConfigNode) (SMS, error) Send(mobile string, template string, params map[string]string) error }
Driver is the interface for sms drivers
type DriverAliyun ¶
type DriverAliyun struct { *Core Config *ConfigAliyun // contains filtered or unexported fields }
DriverAliyun is the driver for sms
func (*DriverAliyun) New ¶
func (d *DriverAliyun) New(core *Core, node *ConfigNode) (SMS, error)
New create new driver object and return
type DriverDiyi ¶
type DriverDiyi struct { *Core Config *ConfigDiyi // contains filtered or unexported fields }
DriverDiyi is the driver for sms.
func (*DriverDiyi) New ¶
func (d *DriverDiyi) New(core *Core, node *ConfigNode) (SMS, error)
New create and return a sms object