mirror of
https://github.com/neilalexander/yggmail.git
synced 2026-04-28 04:46:29 +03:00
Add broadcast regexp parameter
This commit is contained in:
@@ -55,6 +55,7 @@ func main() {
|
||||
smtpaddr := flag.String("smtp", "localhost:1025", "SMTP listen address")
|
||||
imapaddr := flag.String("imap", "localhost:1143", "IMAP listen address")
|
||||
multicast := flag.Bool("multicast", false, "Connect to Yggdrasil peers on your LAN")
|
||||
mcastregexp := flag.String("mcastregexp", ".*", "Regexp for multicast")
|
||||
password := flag.Bool("password", false, "Set a new IMAP/SMTP password")
|
||||
flag.Var(&peerAddrs, "peer", "Connect to a specific Yggdrasil static peer (this option can be given more than once)")
|
||||
flag.Parse()
|
||||
@@ -135,6 +136,7 @@ func main() {
|
||||
case (multicast == nil || !*multicast) && len(peerAddrs) == 0:
|
||||
log.Printf("You must specify either -peer, -multicast or both!")
|
||||
os.Exit(0)
|
||||
|
||||
}
|
||||
|
||||
cfg := &config.Config{
|
||||
@@ -142,7 +144,7 @@ func main() {
|
||||
PrivateKey: sk,
|
||||
}
|
||||
|
||||
transport, err := transport.NewYggdrasilTransport(rawlog, sk, pk, peerAddrs, *multicast)
|
||||
transport, err := transport.NewYggdrasilTransport(rawlog, sk, pk, peerAddrs, *multicast, *mcastregexp)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ type yggdrasilDial struct {
|
||||
context.CancelFunc
|
||||
}
|
||||
|
||||
func NewYggdrasilTransport(log *log.Logger, sk ed25519.PrivateKey, pk ed25519.PublicKey, peers []string, mcast bool) (*YggdrasilTransport, error) {
|
||||
func NewYggdrasilTransport(log *log.Logger, sk ed25519.PrivateKey, pk ed25519.PublicKey, peers []string, mcast bool, mcastregexp string) (*YggdrasilTransport, error) {
|
||||
yellow := color.New(color.FgYellow).SprintfFunc()
|
||||
glog := gologme.New(log.Writer(), fmt.Sprintf("[ %s ] ", yellow("Yggdrasil")), gologme.LstdFlags|gologme.Lmsgprefix)
|
||||
glog.EnableLevel("warn")
|
||||
@@ -86,7 +86,7 @@ func NewYggdrasilTransport(log *log.Logger, sk ed25519.PrivateKey, pk ed25519.Pu
|
||||
{
|
||||
options := []multicast.SetupOption{
|
||||
multicast.MulticastInterface{
|
||||
Regex: regexp.MustCompile(".*"),
|
||||
Regex: regexp.MustCompile(mcastregexp),
|
||||
Beacon: mcast,
|
||||
Listen: mcast,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user