transport is a minimal Go library that provides reusable primitives
for executing requests across different communication transports.
The library focuses strictly on the communication layer, allowing applications to interact with external systems through a unified transport abstraction.
It is designed to remain small, composable, and transport-focused, leaving business logic, orchestration, and data transformation to the application layer.
The library is organized into small composable packages:
transport (core primitives)
├── Client
├── Request
└── Response
↑
client/api (HTTP implementation)
↑
auth (authentication contracts)
↑
credential (request mutation strategies)
↑
provider (credential resolution)
This layering keeps transport execution independent of authentication mechanisms and credential resolution logic.
package main
import (
"context"
"fmt"
"net/http"
"github.com/entiqon/transport"
"github.com/entiqon/transport/client/api"
)
func main() {
ctx := context.Background()
client := api.New(
api.WithHTTPClient(http.DefaultClient),
)
req := &transport.Request{
Method: "GET",
Path: "https://example.com",
}
resp, err := client.Execute(ctx, req)
if err != nil {
panic(err)
}
fmt.Println(resp.Status)
}Credential strategies modify outgoing requests before execution.
client := api.New(
api.WithCredential(
credential.AccessToken("X-Access-Token", "token"),
),
)client := api.New(
api.WithCredential(
credential.BearerToken("token"),
),
)client := api.New(
api.WithCredential(
credential.APIKey("X-API-Key", "key", credential.APIKeyHeader),
),
)client := api.New(
api.WithCredential(
credential.Basic("user", "password"),
),
)client := api.New(
api.WithCredential(
credential.JWT("Authorization", jwtToken),
),
)client := api.New(
api.WithCredential(
credential.HMAC("api-key", "secret"),
),
)Credential providers resolve credentials dynamically from configuration.
Example using an OAuth2 provider:
client := api.New(
api.WithAuthProvider(
provider.OAuth2(http.DefaultClient),
authConfig,
),
)Providers may optionally support credential refresh when tokens expire.
Originally created by Isidro A. Lopez G.
Maintained by Entiqon Labs
MIT License