Documentation
¶
Index ¶
- type AllowDomainHandlerConfig
- type AllowDomainRequest
- type AllowDomainResponse
- type ErrorResponse
- type HandlerFunc
- func NewAllowDomainHandler(cfg AllowDomainHandlerConfig) HandlerFunc
- func NewKVDeleteHandler(cfg KVHandlerConfig) HandlerFunc
- func NewKVGetHandler(cfg KVHandlerConfig) HandlerFunc
- func NewKVListHandler(cfg KVHandlerConfig) HandlerFunc
- func NewKVSetHandler(cfg KVHandlerConfig) HandlerFunc
- func NewVaultGetHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
- func NewVaultListHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
- func NewVaultSetHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
- type KVDeleteRequest
- type KVDeleteResponse
- type KVGetRequest
- type KVGetResponse
- type KVHandlerConfig
- type KVListEntry
- type KVListRequest
- type KVListResponse
- type KVSetRequest
- type KVSetResponse
- type Request
- type Response
- type Server
- type VaultGetRequest
- type VaultGetResponse
- type VaultHandlerConfig
- type VaultListRequest
- type VaultListResponse
- type VaultSetRequest
- type VaultSetResponse
- type VaultState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AllowDomainHandlerConfig ¶
type AllowDomainHandlerConfig struct {
Runtime container.Runtime
ContainerName string
// PromptFunc overrides the tmux popup prompt for testing.
PromptFunc func(domain string) (bool, error)
// ReloadFunc overrides domain reload for testing.
ReloadFunc func(domain string) error
}
AllowDomainHandlerConfig holds dependencies for the allow_domain handler.
type AllowDomainRequest ¶
type AllowDomainRequest struct {
Domain string `json:"domain"`
}
AllowDomainRequest is the payload for "allow_domain" requests.
type AllowDomainResponse ¶
type AllowDomainResponse struct {
Approved bool `json:"approved"`
Error string `json:"error,omitempty"`
}
AllowDomainResponse is the payload for "allow_domain" responses.
type ErrorResponse ¶ added in v0.1.5
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse is a generic error payload for IPC responses.
type HandlerFunc ¶
HandlerFunc processes an IPC request and returns a response payload.
func NewAllowDomainHandler ¶
func NewAllowDomainHandler(cfg AllowDomainHandlerConfig) HandlerFunc
NewAllowDomainHandler returns a HandlerFunc that validates a domain, prompts the user via a tmux popup in the container, and hot-reloads Squid on approval.
func NewKVDeleteHandler ¶ added in v0.1.7
func NewKVDeleteHandler(cfg KVHandlerConfig) HandlerFunc
NewKVDeleteHandler returns a HandlerFunc for "kv_delete" requests.
func NewKVGetHandler ¶ added in v0.1.7
func NewKVGetHandler(cfg KVHandlerConfig) HandlerFunc
NewKVGetHandler returns a HandlerFunc for "kv_get" requests.
func NewKVListHandler ¶ added in v0.1.7
func NewKVListHandler(cfg KVHandlerConfig) HandlerFunc
NewKVListHandler returns a HandlerFunc for "kv_list" requests.
func NewKVSetHandler ¶ added in v0.1.7
func NewKVSetHandler(cfg KVHandlerConfig) HandlerFunc
NewKVSetHandler returns a HandlerFunc for "kv_set" requests.
func NewVaultGetHandler ¶ added in v0.1.6
func NewVaultGetHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
NewVaultGetHandler returns a HandlerFunc for "vault_get" requests.
func NewVaultListHandler ¶ added in v0.1.6
func NewVaultListHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
NewVaultListHandler returns a HandlerFunc for "vault_list" requests.
func NewVaultSetHandler ¶ added in v0.1.7
func NewVaultSetHandler(cfg VaultHandlerConfig, state *VaultState) HandlerFunc
NewVaultSetHandler returns a HandlerFunc for "vault_set" requests.
type KVDeleteRequest ¶ added in v0.1.7
type KVDeleteRequest struct {
Key string `json:"key"`
}
KVDeleteRequest is the payload for "kv_delete" requests.
type KVDeleteResponse ¶ added in v0.1.7
type KVDeleteResponse struct {
Error string `json:"error,omitempty"`
}
KVDeleteResponse is the payload for "kv_delete" responses.
type KVGetRequest ¶ added in v0.1.7
type KVGetRequest struct {
Key string `json:"key"`
}
KVGetRequest is the payload for "kv_get" requests.
type KVGetResponse ¶ added in v0.1.7
type KVGetResponse struct {
Value string `json:"value,omitempty"`
Found bool `json:"found"`
Error string `json:"error,omitempty"`
}
KVGetResponse is the payload for "kv_get" responses.
type KVHandlerConfig ¶ added in v0.1.7
type KVHandlerConfig struct {
WorkspaceName string
// OpenFunc overrides kvstore.Open for testing.
OpenFunc func(opts kvstore.Options) (*kvstore.Store, error)
}
KVHandlerConfig holds dependencies for KV IPC handlers.
type KVListEntry ¶ added in v0.1.7
KVListEntry is a single key-value pair returned by kv_list.
type KVListRequest ¶ added in v0.1.7
type KVListRequest struct {
Prefix string `json:"prefix"`
}
KVListRequest is the payload for "kv_list" requests.
type KVListResponse ¶ added in v0.1.7
type KVListResponse struct {
Entries []KVListEntry `json:"entries,omitempty"`
Error string `json:"error,omitempty"`
}
KVListResponse is the payload for "kv_list" responses.
type KVSetRequest ¶ added in v0.1.7
KVSetRequest is the payload for "kv_set" requests.
type KVSetResponse ¶ added in v0.1.7
type KVSetResponse struct {
Error string `json:"error,omitempty"`
}
KVSetResponse is the payload for "kv_set" responses.
type Request ¶
type Request struct {
Type string `json:"type"`
ID string `json:"id"`
Payload json.RawMessage `json:"payload"`
}
Request is a message sent from the container to the host.
type Response ¶
type Response struct {
Type string `json:"type"`
ID string `json:"id"`
Payload interface{} `json:"payload"`
}
Response is a message sent from the host back to the container.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server listens on a Unix domain socket and dispatches JSON-lines messages.
func (*Server) Handle ¶
func (s *Server) Handle(msgType string, h HandlerFunc)
Handle registers a handler for a message type. Must be called before Start.
func (*Server) SocketDir ¶
SocketDir returns the directory containing the socket (for container mount).
type VaultGetRequest ¶ added in v0.1.6
type VaultGetRequest struct {
Key string `json:"key"`
}
VaultGetRequest is the payload for "vault_get" requests.
type VaultGetResponse ¶ added in v0.1.6
type VaultGetResponse struct {
Value string `json:"value,omitempty"`
Approved bool `json:"approved"`
Error string `json:"error,omitempty"`
}
VaultGetResponse is the payload for "vault_get" responses.
type VaultHandlerConfig ¶ added in v0.1.6
type VaultHandlerConfig struct {
Runtime container.Runtime
ContainerName string
WorkspaceName string
// PromptPasswordFunc overrides the tmux popup password prompt for testing.
PromptPasswordFunc func() (string, error)
// PromptApproveFunc overrides the tmux popup approval prompt for testing.
PromptApproveFunc func(key string) (bool, error)
// PromptApproveSetFunc overrides the tmux popup approval prompt for vault set.
PromptApproveSetFunc func(key string) (bool, error)
// OpenFunc overrides vault.Open for testing.
OpenFunc func(workspace, password string) (map[string]string, error)
// QuickSetFunc overrides vault write for testing. Called with (workspace, password, key, value).
QuickSetFunc func(workspace, password, key, value string) error
}
VaultHandlerConfig holds dependencies for vault IPC handlers.
type VaultListRequest ¶ added in v0.1.6
type VaultListRequest struct{}
VaultListRequest is the payload for "vault_list" requests.
type VaultListResponse ¶ added in v0.1.6
type VaultListResponse struct {
Keys []string `json:"keys,omitempty"`
Approved bool `json:"approved"`
Error string `json:"error,omitempty"`
}
VaultListResponse is the payload for "vault_list" responses.
type VaultSetRequest ¶ added in v0.1.7
VaultSetRequest is the payload for "vault_set" requests.
type VaultSetResponse ¶ added in v0.1.7
type VaultSetResponse struct {
Approved bool `json:"approved"`
Error string `json:"error,omitempty"`
}
VaultSetResponse is the payload for "vault_set" responses.
type VaultState ¶ added in v0.1.6
type VaultState struct {
// contains filtered or unexported fields
}
VaultState holds the decrypted vault store in memory between IPC requests. After the first successful password entry, the store is cached so subsequent requests don't require re-entering the password.
func (*VaultState) Cleanup ¶ added in v0.1.6
func (vs *VaultState) Cleanup()
Cleanup resets the in-memory vault state.
func (*VaultState) GetRetrievedSecrets ¶ added in v0.1.8
func (vs *VaultState) GetRetrievedSecrets() map[string]string
GetRetrievedSecrets returns a copy of the retrieved secrets map for redaction.