mirror of
https://github.com/neilalexander/yggmail.git
synced 2026-05-08 12:56:27 +03:00
Use .yggmail TLD
This commit is contained in:
@@ -12,7 +12,7 @@ Yggmail is a single-binary all-in-one mail transfer agent which sends and receiv
|
|||||||
* All mail exchange traffic between any two Yggmail nodes is always end-to-end encrypted without exception;
|
* All mail exchange traffic between any two Yggmail nodes is always end-to-end encrypted without exception;
|
||||||
* Yggdrasil and Yggmail nodes on the same network are discovered automatically using multicast or you can configure a static Yggdrasil peer.
|
* Yggdrasil and Yggmail nodes on the same network are discovered automatically using multicast or you can configure a static Yggdrasil peer.
|
||||||
|
|
||||||
Email addresses are based on your public key, like `neilalexander@e3bf4665ae1ff714e0112040af8ddfc8e4b664a28e4afa40746e13952550f9ef`.
|
Email addresses are based on your public key, like `neilalexander@e3bf4665ae1ff714e0112040af8ddfc8e4b664a28e4afa40746e13952550f9ef.yggmail`.
|
||||||
|
|
||||||
## Quickstart
|
## Quickstart
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ func main() {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
fmt.Printf("Created user %q\n", *createuser)
|
fmt.Printf("Created user %q\n", *createuser)
|
||||||
fmt.Printf("Email address will be %s@%s\n", *createuser, hex.EncodeToString(pk))
|
fmt.Printf("Email address will be %s@%s%s\n", *createuser, hex.EncodeToString(pk), smtpserver.TLD)
|
||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,15 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const TLD = ".yggmail"
|
||||||
|
|
||||||
func parseAddress(email string) (string, string, error) {
|
func parseAddress(email string) (string, string, error) {
|
||||||
|
if !strings.HasSuffix(email, TLD) {
|
||||||
|
return "", "", fmt.Errorf("invalid TLD")
|
||||||
|
}
|
||||||
at := strings.LastIndex(email, "@")
|
at := strings.LastIndex(email, "@")
|
||||||
if at == 0 {
|
if at == 0 {
|
||||||
return "", "", fmt.Errorf("invalid email address")
|
return "", "", fmt.Errorf("invalid email address")
|
||||||
}
|
}
|
||||||
return email[:at], email[at+1:], nil
|
return email[:at], strings.TrimSuffix(email[at+1:], TLD), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user