Help us shape the future of Go! Take the 2026 Go Developer Survey

credentials

package
v1.25.0-beta.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// #nosec G101 -- Public HTTP header carrying a nonsecret relay identifier.
	HeaderCredentialsInstance = "X-Devsy-Credentials-Instance"
	// #nosec G101 -- Public HTTP header carrying a nonsecret host identifier.
	HeaderCredentialsHostOwner = "X-Devsy-Credentials-Host-Owner"
)
View Source
const DefaultPort = "12049"
View Source
const ReadinessVersion = 1

Variables

This section is empty.

Functions

func FetchOwner added in v1.16.0

func FetchOwner(ctx context.Context, port int) (string, error)

FetchOwner returns "" without error if owner is unset or ownerPath is missing.

func GetPort

func GetPort() (int, error)

func LoopbackHTTPClient

func LoopbackHTTPClient() *http.Client

func PingURL

func PingURL(ctx context.Context, url string) error

func PostWithRetry

func PostWithRetry(port int, endpoint string, body io.Reader) ([]byte, error)

func RunCredentialsServer

func RunCredentialsServer(
	ctx context.Context,
	port int,
	client CredentialsClient,
	owner string,
) error

func RunCredentialsServerWithListener added in v1.13.0

func RunCredentialsServerWithListener(
	ctx context.Context,
	ln net.Listener,
	client CredentialsClient,
	owner string,
) error

RunCredentialsServerWithListener is like RunCredentialsServer, but takes an already-bound listener. Use this when the caller must hold the port exclusively (via net.Listen) from before startup through to serving, so no other process can bind the same port in between.

func RunPreparedCredentialsServer

func RunPreparedCredentialsServer(
	ctx context.Context,
	ln net.Listener,
	client CredentialsClient,
	status Readiness,
) error

func StartCredentialsServer

func StartCredentialsServer(
	ctx context.Context,
	client CredentialsClient,
) (int, error)

Types

type CredentialsClient added in v1.10.0

type CredentialsClient interface {
	GitCredentials(
		ctx context.Context, in *tunnel.Message, opts ...grpc.CallOption,
	) (*tunnel.Message, error)
	DockerCredentials(
		ctx context.Context, in *tunnel.Message, opts ...grpc.CallOption,
	) (*tunnel.Message, error)
	GitSSHSignature(
		ctx context.Context, in *tunnel.Message, opts ...grpc.CallOption,
	) (*tunnel.Message, error)
	GPGPublicKeys(
		ctx context.Context, in *tunnel.Message, opts ...grpc.CallOption,
	) (*tunnel.Message, error)
	DevsyConfig(
		ctx context.Context, in *tunnel.Message, opts ...grpc.CallOption,
	) (*tunnel.Message, error)
}

type Readiness

type Readiness struct {
	Version       int    `json:"version"`
	Owner         string `json:"owner"`
	HostOwner     string `json:"host_owner"`
	Instance      string `json:"instance"`
	GitHubAllowed bool   `json:"github_allowed"`
	GitHubState   string `json:"github_state"`
	Address       string `json:"-"`
}

func ProbeReadiness

func ProbeReadiness(ctx context.Context, port int, expected Readiness) (Readiness, error)

func (Readiness) Matches

func (r Readiness) Matches(expected Readiness) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL