Documentation ¶
Index ¶
- Constants
- Variables
- type API
- type Bridge
- type BridgeImpl
- func (b *BridgeImpl) AddSubscription(subscription *client.Subscription) (string, error)
- func (b *BridgeImpl) Close() error
- func (b *BridgeImpl) Config() *Config
- func (b *BridgeImpl) DeleteSubscription(ID string) error
- func (b *BridgeImpl) HookEvent(uri, event_type string, request []byte) error
- func (b *BridgeImpl) Subscriptions() []*client.Subscription
- type Config
- type Pipe
- type PipeImpl
- type Subscriber
- type Subscribers
Constants ¶
const ( DEFAULT_API_INTERFACE = "127.0.0.1" DEFAULT_API_PORT = "8989" DEFAULT_API_BINDING = DEFAULT_API_INTERFACE + ":" + DEFAULT_API_PORT SESSION_REQUEST = "sess_request" SESSION_HIJACKED = "sess_hijacked" )
const (
SUBSCRIPTION_MIN_ID = 32
)
Variables ¶
var (
RequestHeaders = []string{"User-Agent", "Content-Type", "Accept", "Host", "Upgrade"}
)
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
The REST API for processing dynamic hook registration
type Bridge ¶
type Bridge interface { // retrieve the confir Config() *Config // a hook event HookEvent(string, string, []byte) error // hand back a list of subscriptions Subscriptions() []*client.Subscription // add a new subscription AddSubscription(*client.Subscription) (string, error) // remove a subscription from the bridge DeleteSubscription(string) error // shutdown and release the resources Close() error }
The Bridge act as a hook the the API, as requests a passed through the chain, the bridge is called to see if anyone is listening to the API hook, forwards it on, hands back the mutated resource and allows it to continue;
type BridgeImpl ¶
the bridge implementation
func (*BridgeImpl) AddSubscription ¶
func (b *BridgeImpl) AddSubscription(subscription *client.Subscription) (string, error)
Add a new subscription to the bridge
subscription: a pointer to the Subscription
func (*BridgeImpl) Close ¶
func (b *BridgeImpl) Close() error
Close and release any resource being used by the bride
func (*BridgeImpl) Config ¶
func (b *BridgeImpl) Config() *Config
Return a pointer to the configuration
func (*BridgeImpl) DeleteSubscription ¶
func (b *BridgeImpl) DeleteSubscription(ID string) error
Remove the subscription from the bridge
id: the subscription id which was given on subscribe()
func (*BridgeImpl) HookEvent ¶
func (b *BridgeImpl) HookEvent(uri, event_type string, request []byte) error
func (*BridgeImpl) Subscriptions ¶
func (b *BridgeImpl) Subscriptions() []*client.Subscription
Retrieve the current subscriptions which are in the bridge
type Config ¶
type Config struct { // the interface spec the admin api bind to Bind string `json:"bind"` // the token used to authenticate Token string `json:"token"` // a map of the registrations Subscriptions []*client.Subscription `json:"subscriptions"` // an array of source and sinks -H tcp://0.0.0.0:3000,unix://var/run/docker.sock Pipes []string `json:"pipes"` // the verbose level Verbosity int `json:"verbose"` }
the configuration for the bridge
func LoadConfig ¶
Load the configuration for the bridge from the config file
filename: the full path to the configuration file
type PipeImpl ¶
type PipeImpl struct {
// contains filtered or unexported fields
}
A pipe is source and sink connection to the docker api i.e. create unix://var/run/docker.sock -> tcp://0.0.0.0:2375
type Subscriber ¶
type Subscriber struct {
Location string
}
type Subscribers ¶
type Subscribers struct { }