Skip to content

Commit a0154b8

Browse files
committed
Initial commit
0 parents  commit a0154b8

File tree

9 files changed

+711
-0
lines changed

9 files changed

+711
-0
lines changed

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
goreleaser:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
- name: Validate Tag Format
19+
run: |
20+
echo "Validating tag $GITHUB_REF..."
21+
if [[ ! "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+(\.[0-9]+)*)?$ ]]; then
22+
echo "Invalid tag format: $GITHUB_REF"
23+
echo "Expected format: vMAJOR.MINOR.PATCH (e.g. v1.0.0)"
24+
echo "(Pre-release tags are also valid, e.g. v1.0.0-alpha)"
25+
exit 1
26+
fi
27+
- uses: actions/setup-go@v4
28+
with:
29+
go-version: ">=1.22.0"
30+
- uses: goreleaser/goreleaser-action@v5
31+
with:
32+
distribution: goreleaser
33+
version: latest
34+
args: release --clean
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/go
2+
3+
# Binaries for programs and plugins
4+
*.exe
5+
*.exe~
6+
*.dll
7+
*.so
8+
*.dylib
9+
10+
# Test binary, built with `go test -c`
11+
*.test
12+
13+
# Output of the go coverage tool, specifically when used with LiteIDE
14+
*.out
15+
16+
# Go workspace file
17+
go.work
18+
19+
# End of https://www.toptal.com/developers/gitignore/api/go
20+
21+
# Build files
22+
masked_fastmail
23+
dist/

.goreleaser.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
2+
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
3+
project_name: masked_fastmail
4+
version: 2
5+
6+
before:
7+
hooks:
8+
- go mod tidy
9+
10+
builds:
11+
- env:
12+
- CGO_ENABLED=0
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
ldflags:
18+
- -s -w
19+
- "-X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}"
20+
21+
archives:
22+
- format: tar.gz
23+
# this name template makes the OS and Arch compatible with the results of `uname`.
24+
name_template: >-
25+
{{ .ProjectName }}_
26+
{{- title .Os }}_
27+
{{- if eq .Arch "amd64" }}x86_64
28+
{{- else if eq .Arch "386" }}i386
29+
{{- else }}{{ .Arch }}{{ end }}
30+
{{- if .Arm }}v{{ .Arm }}{{ end }}
31+
# use zip for windows archives
32+
format_overrides:
33+
- goos: windows
34+
format: zip
35+
36+
changelog:
37+
sort: asc
38+
groups:
39+
- title: Features
40+
regexp: "^feat:"
41+
order: 0
42+
- title: Bug Fixes
43+
regexp: "^fix:"
44+
order: 1
45+
- title: Others
46+
order: 999
47+
filters:
48+
exclude:
49+
- "^docs:"
50+
- "^test:"
51+
- "^ci:"
52+
- "^chore:"
53+
- "^refactor:"

LICENSE

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
BSD 3-Clause License
2+
3+
Copyright 2024 Fredrik Randsborg Bølstad
4+
5+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6+
7+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8+
9+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10+
11+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
12+
13+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Masked Fastmail
2+
3+
A simple CLI tool for managing [Fastmail masked email aliases](https://www.fastmail.com/features/masked-email/).
4+
Easily create new aliases for websites or manage existing ones.
5+
6+
## Features
7+
8+
- Get or create masked email addresses for domains
9+
- Aliases are automatically copied to clipboard
10+
- Enable/disable/delete aliases
11+
12+
## Installation
13+
14+
```shell
15+
go install github.com/fredrikrab/masked_fastmail@latest
16+
```
17+
18+
Or build from source (see below).
19+
20+
## Usage
21+
22+
```text
23+
Usage:
24+
masked_fastmail <url> (no flags)
25+
manage_fastmail <alias> [flags]
26+
27+
Flags:
28+
--delete delete alias (bounce messages)
29+
-d, --disable disable alias (send to trash)
30+
-e, --enable enable alias
31+
-h, --help show this message
32+
-v, --version show version information
33+
```
34+
35+
The following environment variables must be set:
36+
37+
```shell
38+
export FASTMAIL_ACCOUNT_ID=your_account_id
39+
export FASTMAIL_API_KEY=your_api_key
40+
```
41+
42+
### Examples
43+
44+
#### Get or create alias
45+
46+
A new alias will only be created if one does not already exist.
47+
In either case, the alias is automatically copied to the clipboard.
48+
49+
```shell
50+
masked_fastmail example.com
51+
```
52+
53+
Copying is done with [Clipboard for Go](https://pkg.go.dev/github.com/atotto/clipboard#section-readme) and should work on all platforms.
54+
55+
#### Enable an existing alias
56+
57+
New Fastmail aliases are initialized to `pending`, and are set to `enabled` once they receive their first email.
58+
However, they get automatically deleted if no email is received within 24 hours.
59+
Some services may not send a timely welcome email, in which case it's helpful to manually enable the alias.
60+
61+
```shell
62+
masked_fastmail --enable user.123456@fastmail.com
63+
```
64+
65+
#### Disable an alias
66+
67+
This causes all new new emails to be moved to trash.
68+
69+
```shell
70+
masked_fastmail --disable user.123456@fastmail.com
71+
```
72+
73+
## Build from source
74+
75+
1. Clone the repository
76+
2. Run `go build -o masked_fastmail`
77+
78+
### Prerequisites
79+
80+
- Go 1.22+
81+
- Fastmail API credentials
82+
83+
### API documentation
84+
85+
- The API documentation can be found at [https://www.fastmail.com/dev/maskedemail](https://www.fastmail.com/dev/maskedemail)
86+
- It's also helpful to review the [JMAP protocol](https://jmap.io/crash-course.html)
87+
88+
## License
89+
90+
BSD 3-Clause License

0 commit comments

Comments
 (0)