Documentation
¶
Overview ¶
govanityurls serves Go vanity URLs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var IAPHeaderNotExist = errors.New("x-goog-iap-jwt-assertion header is not present")
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
func NewApp ¶
func NewApp(host string, cacheMaxAge int, store storage.Storage, fallback *FallbackConfig, registries []registry.Registry, asyncCfg *AsyncRegisterConfig, logger slogLimitedLogger) *App
NewServer creates a new http.Server which responds to Go's import meta tags. The `addr` is http.Server.Addr. It is required, and the format "host:port" is not recommended here. please just use ":port". The `host` is the host name that will be used in the import meta tags. This is required if your app sets behind a reverse proxy, or environment like App Engine or Cloud Run but you only allows the source code to be retrived through the canonical custom domain URL. Besides, you can modify the timeouts of the server, just like a normal `http.Server`.
func (*App) GetPrivateHandlers ¶
GetPrivateHandlers returns a sequence of private handlers. It returns a string: http.Handler pair. The string is the path of the handler, which has the compatiable format for http.ServeMux (Go1.22+).
func (*App) GetPublicHandlers ¶
GetPublicHandlers returns a sequence of public handlers. It returns a string: http.Handler pair. The string is the path of the handler, which has the compatiable format for http.ServeMux (Go1.22+).
func (*App) RegisterShutdownFunc ¶
type AsyncRegisterConfig ¶
type AsyncRegisterConfig struct {
TaskClient TaskSubmitter
TaskClientServiceAccount string
}
type CloudTasksSubmitter ¶
type CloudTasksSubmitter struct {
// contains filtered or unexported fields
}
CloudTasksSubmitter implements TaskSubmitter. It uses Cloud Tasks to do asynchrous calls. It manages submitting tasks to Google Cloud Tasks.
func NewCloudTasksSubmitter ¶
func NewCloudTasksSubmitter(client *cloudtasks.Client, queuePath, targetURL, serviceAccountEmail string, opts ...CloudTasksSubmitterOption) *CloudTasksSubmitter
NewCloudTasksSubmitter creates a new CloudTasksSubmitter. It uses `client`, `queuePath` to push requests to `targetURL`, on the behalf of `serviceAccountEmail`.
func (*CloudTasksSubmitter) Close ¶
func (s *CloudTasksSubmitter) Close(ctx context.Context) error
Close closes the underlying client.
func (*CloudTasksSubmitter) CreateTask ¶
func (s *CloudTasksSubmitter) CreateTask(ctx context.Context, payload *WriteConfigPayload) error
CreateTask submits a task to write the configuration to storage.
type CloudTasksSubmitterOption ¶
type CloudTasksSubmitterOption func(*CloudTasksSubmitter)
CloudTasksSubmitterOption is an option for CloudTasksSubmitter.
func WithAudience ¶
func WithAudience(audience string) CloudTasksSubmitterOption
WithAudience is a CloudTasksSubmitterOption that sets the audience for the task.
type FallbackConfig ¶
type FallbackConfig struct {
RepoChecker registry.RepoChecker
Registry registry.Registry
}
type IAP ¶
type IAP struct {
// contains filtered or unexported fields
}
IAP validates IAP JWT tokens.
type TaskSubmitter ¶
type TaskSubmitter interface {
CreateTask(ctx context.Context, payload *WriteConfigPayload) error
Close(ctx context.Context) error
}
TaskSubmitter let us do asynchrous write-back to storage.
type WriteConfigPayload ¶
type WriteConfigPayload struct {
Path string `json:"path"`
Config *storage.RepoConfig `json:"config"`
}
WriteConfigPayload defines the payload for creating a repo configuration.