CLI email sender

This commit is contained in:
Bel LaPointe
2019-07-03 11:48:52 -06:00
commit 4ca33e1c7b
50 changed files with 9996 additions and 0 deletions

77
vendor/local/system/sysconf/conf.json vendored Executable file
View File

@@ -0,0 +1,77 @@
[
{
"Name": "watchmans",
"Port": "9988,9998"
},
{
"Name": "ytubespdrun",
"Port": "29687",
"Log": "/volume1/video/Bel/YouTube/Speedrun/"
},
{
"Name": "emailmonitor",
"Log": "breellocaldev@gmail.com",
"Timeout": "15m"
},
{
"Name": "vpntorfeed",
"Port": "29688",
"DB": "magnets",
"IP2": "http://192.168.0.86:9091/transmission/rpc",
"Pub": "X-Transmission-Session-Id"
},
{
"Name": "broadcaster",
"Timeout": "5s",
"IP": "localhost"
},
{
"Name": "jbt-serve",
"Timeout": "5s",
"IP": "localhost",
"Port": "59998"
},
{
"Name": "jbt-client",
"Timeout": "5s",
"IP": "localhost"
},
{
"Name": "nat-serve",
"Timeout": "5s",
"IP": "localhost",
"Port": "59997"
},
{
"Name": "Coordinator",
"Port": "50000"
},
{
"Name": "rss-monitor",
"Timeout": "5s",
"IP": "localhost",
"Port": "28686",
"Log": "./alt5.log",
"DB": "./alt5.db",
"Measure": false,
"Intervalunit": "1s",
"ConfFile": "./conf.json",
"Overwrite": true
},
{
"Name": "sev-alerts",
"IP": "https://qualtrics.atlassian.net/sr/jira.issueviews:searchrequest-rss/44938/SearchRequest-44938.xml?tempMax=1000",
"Port": "YnJlZWxAcXVhbHRyaWNzLmNvbTpeKllycGl6Y3cmNTRPd3Yw",
"Timeout": "720h",
"Intervalunit": "30m"
},
{
"Name": "email",
"Log": "breellocaldev@gmail.com",
"IP": "smtp.gmail.com:465",
"IP2": "pop.gmail.com:995",
"Port": "ML3WQRFSqe9rQ8qNkm",
"DB": "mailto:3852010864@txt.att.net",
"Pub": "xsBNBFsn3DkBCADFA7dD+urJE82QrqsTK9cPS4S1stfCglnh4kpFQRO98cX2FRYlIlWJYnVr8IUTI+fAb0XymB+kLOUYtgMQp7vK7M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3jG0f+tqgGxzgGsSDhcZC9h1QfWvh1nw/q0EZzwI8+lAsEfBeVNOjZttZI+RMyO9NBTwJErq4EeuemNCqu93zJOf3i45G0+jGV9/XMga5641CfIuFPKkcWBMR67iiEu2/vG7e9l1IkR74pBJhp2ub8aaivWvNS1lloYESee0euGu/TOXe7FO6V6E1KVw+17A78NlG09WCO5c5SZdDI9YCXxEeqHzNH4j2RrAxNsYZ3M6L0+JbVqwWFN73OUi6EM7fQFdpXCryKV6OEKnYKeGPW2TRUrT+gBgLnJV0crVTibaOSXdq+vyuHszKdT0lcLmEj2F3i73vmvUKYMh/shA=="
}
]

166
vendor/local/system/sysconf/const.go vendored Executable file
View File

@@ -0,0 +1,166 @@
package sysconf
import (
"encoding/json"
"fmt"
"io/ioutil"
"local/logger"
"os"
"path"
"strconv"
"strings"
"time"
)
type Conf struct {
Name string
Pub string
Port string
IP string
IP2 string
TimeOut time.Duration
Timeout string
Log string
DB string
Measure bool
IntervalUnit time.Duration
Intervalunit string
Overwrite bool
ConfFile string
}
var configs map[string]Conf
func (c Conf) String() string {
kv := make(map[string]interface{})
kv["name"] = c.Name
kv["port"] = c.Port
kv["IP"] = c.IP
kv["IP2"] = c.IP2
out := ""
for k, v := range kv {
out += fmt.Sprintf("%v:%v ", k, v)
}
return out
}
func Get(name string) Conf {
if configs == nil {
open()
}
if _, ok := configs[name]; !ok {
panic("Unknown service " + name)
}
logger.Log("config: got", name, "config: ", configs[name])
return configs[name]
}
func open() {
f, err := ioutil.ReadFile(path.Join(os.Getenv("GOPATH"), "src", "local1", "system", "sysconf", "conf.json"))
if err != nil {
panic(err)
}
var jsonConfs []Conf
err = json.Unmarshal([]byte(string(f)), &jsonConfs)
if err != nil {
panic(err)
}
configs = make(map[string]Conf)
ports := make(map[string]bool)
initPort := 28685
thisPort := 0
for i := range jsonConfs {
portstr := jsonConfs[i].Port
portlist := strings.Split(portstr, ",")
for j := range portlist {
ports[portlist[j]] = true
}
}
for i := range jsonConfs {
if jsonConfs[i].Timeout != "" {
jsonConfs[i].TimeOut, err = time.ParseDuration(jsonConfs[i].Timeout)
if err != nil {
panic(err)
}
}
if jsonConfs[i].Intervalunit != "" {
jsonConfs[i].IntervalUnit, err = time.ParseDuration(jsonConfs[i].Intervalunit)
if err != nil {
panic(err)
}
}
if jsonConfs[i].Port == "" {
thisPort += 1
port := strconv.Itoa(initPort + thisPort)
for _, ok := ports[port]; ok; _, ok = ports[port] {
port = strconv.Itoa(initPort + thisPort)
thisPort++
}
jsonConfs[i].Port = port
ports[jsonConfs[i].Port] = true
}
if jsonConfs[i].Log != "" && jsonConfs[i].Log[0] == '.' {
jsonConfs[i].Log = os.Getenv("MNT") + jsonConfs[i].Log
}
if jsonConfs[i].DB != "" && jsonConfs[i].DB[0] == '.' {
jsonConfs[i].DB = os.Getenv("MNT") + jsonConfs[i].DB
}
if jsonConfs[i].ConfFile != "" && jsonConfs[i].ConfFile[0] == '.' {
jsonConfs[i].ConfFile = os.Getenv("MNT") + jsonConfs[i].ConfFile
}
configs[jsonConfs[i].Name] = jsonConfs[i]
}
}
/*
var (
Broadcaster = Conf{
Name: "broadcaster",
Port: "28688",
Timeout: time.Second * 5,
IP: "localhost",
}
JBTServe = Conf{
Name: "jbt-serve",
Port: "28080",
Timeout: time.Second * 5,
IP: "localhost",
}
JBTClient = Conf{
Name: "jbt-client",
Port: "28081",
Timeout: time.Second * 5,
IP: "localhost",
}
NATServe = Conf{
Name: "nat-serve",
Port: "28447",
Timeout: time.Second * 5,
IP: "localhost",
}
RSSMon = Conf{
Name: "rss-monitor",
Port: "28686",
Timeout: time.Second * 5,
IP: "localhost",
Log: "./my.log",
DB: "./my.db",
Measure: false,
IntervalUnit: time.Second,
}
SevAlerts = Conf{
Name: "sev-alerts",
IP: "https://qualtrics.atlassian.net/sr/jira.issueviews:searchrequest-rss/44938/SearchRequest-44938.xml?tempMax=1000",
Port: "YnJlZWxAcXVhbHRyaWNzLmNvbTpeKllycGl6Y3cmNTRPd3Yw",
Timeout: time.Minute * 60,
IntervalUnit: time.Minute * 15,
}
Email = Conf{
Name: "bbarl64@gmail.com",
IP: "smtp.gmail.com:465",
Port: ">_w2Xeq\"tvJkv5y\\",
DB: "3852010864@txt.att.net",
}
)
*/

5
vendor/local/system/sysconf/topic.go vendored Executable file
View File

@@ -0,0 +1,5 @@
package sysconf
var (
RSSFeedItem = "rssFeedItem."
)