ExchPub string
SignPub string
NoisePub string
+ Sendmail []string
Incoming *string `incoming,omitempty`
Freq *string `freq,omitempty`
Via []string `via,omitempty`
Self NodeOurYAML
Neigh map[string]NodeYAML
- Spool string
- Log string
- Sendmail []string
- Notify *NotifyYAML `notify,omitempty`
+ Spool string
+ Log string
+ Notify *NotifyYAML `notify,omitempty`
}
func NewNode(name string, yml NodeYAML) (*Node, error) {
ExchPub: new([32]byte),
SignPub: ed25519.PublicKey(signPub),
NoisePub: new([32]byte),
+ Sendmail: yml.Sendmail,
Incoming: incoming,
Freq: freq,
Addrs: yml.Addrs,
return nil, errors.New("Log path must be absolute")
}
ctx := Ctx{
- Spool: spoolPath,
- LogPath: logPath,
- Self: self,
- Neigh: make(map[NodeId]*Node, len(cfgYAML.Neigh)),
- Alias: make(map[string]*NodeId),
- Sendmail: cfgYAML.Sendmail,
+ Spool: spoolPath,
+ LogPath: logPath,
+ Self: self,
+ Neigh: make(map[NodeId]*Node, len(cfgYAML.Neigh)),
+ Alias: make(map[string]*NodeId),
}
if cfgYAML.Notify != nil {
if cfgYAML.Notify.File != nil {
ExchPub: nncp.ToBase32(nodeOur.ExchPub[:]),
SignPub: nncp.ToBase32(nodeOur.SignPub[:]),
NoisePub: nncp.ToBase32(nodeOur.NoisePub[:]),
+ Sendmail: []string{nncp.DefaultSendmailPath},
Incoming: &incoming,
Freq: &freq,
Addrs: map[string]string{"main": "localhost:5400"},
},
},
- Spool: "/path/to/spool",
- Log: "/path/to/log.file",
- Sendmail: []string{nncp.DefaultSendmailPath},
+ Spool: "/path/to/spool",
+ Log: "/path/to/log.file",
Notify: &nncp.NotifyYAML{
File: &nncp.FromToYAML{
From: "nncp@localhost",
Neigh map[NodeId]*Node
Alias map[string]*NodeId
- Spool string
- Sendmail []string
-
+ Spool string
LogPath string
Debug bool
NotifyFile *FromToYAML
ExchPub *[32]byte
SignPub ed25519.PublicKey
NoisePub *[32]byte
+ Sendmail []string
Incoming *string
Freq *string
Via []*NodeId
if err != nil {
log.Fatalln(err)
}
+ sendmail := ctx.Neigh[*job.PktEnc.Sender].Sendmail
cmd := exec.Command(
- ctx.Sendmail[0],
+ sendmail[0],
append(
- ctx.Sendmail[1:len(ctx.Sendmail)],
+ sendmail[1:len(sendmail)],
strings.Split(recipients, " ")...,
)...,
)
if err = os.Remove(job.Fd.Name()); err != nil {
ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "remove")
}
+ sendmail := ctx.Neigh[*ctx.Self.Id].Sendmail
if ctx.NotifyFile != nil {
cmd := exec.Command(
- ctx.Sendmail[0],
- append(
- ctx.Sendmail[1:len(ctx.Sendmail)],
- ctx.NotifyFile.To,
- )...,
+ sendmail[0],
+ append(sendmail[1:len(sendmail)], ctx.NotifyFile.To)...,
)
cmd.Stdin = newNotification(ctx.NotifyFile, fmt.Sprintf(
"File from %s: %s (%s)",
ctx.LogE("rx", SdsAdd(sds, SDS{"err": err}), "remove")
}
if ctx.NotifyFreq != nil {
+ sendmail := ctx.Neigh[*ctx.Self.Id].Sendmail
cmd := exec.Command(
- ctx.Sendmail[0],
- append(
- ctx.Sendmail[1:len(ctx.Sendmail)],
- ctx.NotifyFreq.To,
- )...,
+ sendmail[0],
+ append(sendmail[1:len(sendmail)], ctx.NotifyFreq.To)...,
)
cmd.Stdin = newNotification(ctx.NotifyFreq, fmt.Sprintf(
"Freq from %s: %s",
if len(dirFiles(rxPath)) == 0 {
return false
}
- ctx.Sendmail = []string{"/bin/sh", "-c", "false"}
+ ctx.Neigh[*nodeOur.Id].Sendmail = []string{"/bin/sh", "-c", "false"}
ctx.Toss(ctx.Self.Id, DefaultNiceMail)
if len(dirFiles(rxPath)) == 0 {
return false
}
- ctx.Sendmail = []string{
+ ctx.Neigh[*nodeOur.Id].Sendmail = []string{
"/bin/sh", "-c",
fmt.Sprintf("cat >> %s", filepath.Join(spool, "mbox")),
}