Skip to content

platform: add GetMailRelay - #2

Merged
cyberb merged 4 commits into
masterfrom
mail-relay
Jul 31, 2026
Merged

platform: add GetMailRelay#2
cyberb merged 4 commits into
masterfrom
mail-relay

Conversation

@cyberb

@cyberb cyberb commented Jul 29, 2026

Copy link
Copy Markdown
Member

Client method for the Syncloud mail relay, so apps can read the relay endpoint and credentials the platform serves on the app api socket.

3 of 4 PRs: platform · golib (this) · mail · redirect.

Changes

  • Client.GetMailRelay()GET http://unix/mail/relay, returning {enabled, host, port, login, password}.
  • The endpoint returns an object rather than a string, so it gets its own MailRelayResponse instead of reusing the shared Response, whose Data is a string.
  • A missing endpoint is reported as the relay being disabled. An app built against this library has to keep working on a platform that predates the relay, where a 404 means the feature is unavailable rather than that the call failed. Without this the mail app's install hook fails outright on an older platform.

Credentials are the device's existing domain update token and device domain — the same pair the frp traffic relay uses — so this call provisions and stores nothing.

Verification

go build ./... and gofmt clean; go test ./platform/... passes, including tests for the enabled, disabled and missing-endpoint responses.

Requires syncloud/platform#761 for the endpoint to exist. The mail app currently depends on this branch by commit and moves to a tagged release once this merges.

Apps need the mail relay endpoint and credentials the platform serves on
the app api socket. The response carries an object rather than a string,
so it gets its own typed response instead of reusing Response.
An app built against this library has to keep working on a platform that
predates the mail relay, where the endpoint does not exist. A 404 means the
feature is unavailable, not that the call failed, so report it as disabled
rather than an error that would fail an install hook.
cyberb added 2 commits July 31, 2026 16:52
One struct per file named after it, and GetMailRelay alongside the other
Client methods rather than in a file of its own.
Without a trigger the pipeline ran for both push and pull_request, so every
commit produced two identical builds. Branches live in this repo, so push
still covers pull request commits.
@cyberb
cyberb merged commit 8e48ec6 into master Jul 31, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant