Files
origin_client/go/README.md
T
warkanumandClaude Sonnet 5 2590e404f5
CI / rust (push) Successful in 3m6s
CI / go (push) Successful in 33s
CI / js (push) Successful in 34s
feat: initial Go/JS/Rust Origin check-in client SDKs
Standalone clients that resolve a machine unique ID (OS machine ID first,
falling back to a generated UUID persisted to disk), detect hostname/IP/
container/orchestrator, and register+re-ping origin.warky.dev's public
service-checkin endpoint on a daily interval. Ported from icy2's internal
origincheckin package but extended to the full check-in contract and made
dependency-light for external reuse.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-01 15:25:30 +02:00

46 lines
1.4 KiB
Markdown

# originclient (Go)
```
go get git.warky.dev/wdevs/origin_client/go
```
## Usage
```go
c, err := originclient.New(originclient.Config{
ServiceKey: "...",
Type: "myservice",
Version: "1.2.3",
Name: "myservice-nova",
})
if err != nil {
log.Fatal(err)
}
go c.Run(ctx) // immediate check-in, then every 24h until ctx is done
```
Call `c.CheckinOnce(ctx)` directly instead of `Run` to send a single
check-in and observe the error/response.
## Config
| Field | Required | Default |
|---|---|---|
| `ServiceKey` | yes | — |
| `Type`, `Version`, `Name` | yes | — |
| `URL` | no | `DefaultURL` (`https://origin.warky.dev/api/public/service-checkin`) |
| `AppType` | no | `"go"` |
| `Hostname` | no | OS hostname |
| `ContainerID` | no | best-effort Docker/cgroup detection |
| `Orchestrator` | no | best-effort Kubernetes/Docker detection |
| `InstallID` | no | OS machine ID, else a generated UUID persisted to `InstallIDPath` |
| `IntervalHours` | no | `DefaultIntervalHours` (24) |
| `Logger` | no | discards warnings |
`Site`, `Environment`, `DatabaseType`, `DatabaseName`, `Port`, `BaseURL`,
`InternalURL`, `Description` are optional metadata with no default.
`Hostname()`, `OutboundIP()`, `ContainerID()`, `Orchestrator()`, and
`ResolveMachineID()` are exported standalone for callers that want the
detection logic without the HTTP client.