Documentation ¶
Index ¶
- Variables
- func GenCerts(cfg ServerConfig) (err error)
- type Client
- func (c *Client) Delete(key string) (err error)
- func (c *Client) Get(key string) (value string, err error)
- func (c *Client) GetOrCreateLock(key string, lockKeyTTL time.Duration) (mylock bool, err error)
- func (c *Client) OverWriteLock(key string) (err error)
- func (c *Client) PutTx(key string, value string) (err error)
- func (c *Client) SetLock(key string) (err error)
- func (c *Client) TryRecreateLock(key string) (recreated bool, err error)
- type Clienter
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrKeyAlreadyExists - Testable error for when a key already exists ErrKeyAlreadyExists = errors.New("Key Already Exists") // ErrKeyMissing - testable error for no expected key defined ErrKeyMissing = errors.New("Key not defined") )
var ExtKeyUsage = map[string]x509.ExtKeyUsage{ "any": x509.ExtKeyUsageAny, "server auth": x509.ExtKeyUsageServerAuth, "client auth": x509.ExtKeyUsageClientAuth, "code signing": x509.ExtKeyUsageCodeSigning, "email protection": x509.ExtKeyUsageEmailProtection, "s/mime": x509.ExtKeyUsageEmailProtection, "ipsec end system": x509.ExtKeyUsageIPSECEndSystem, "ipsec tunnel": x509.ExtKeyUsageIPSECTunnel, "ipsec user": x509.ExtKeyUsageIPSECUser, "timestamping": x509.ExtKeyUsageTimeStamping, "ocsp signing": x509.ExtKeyUsageOCSPSigning, "microsoft sgc": x509.ExtKeyUsageMicrosoftServerGatedCrypto, "netscape sgc": x509.ExtKeyUsageNetscapeServerGatedCrypto, }
ExtKeyUsage - contains a mapping of string names to extended key usages.
var ( // Timeout - For now a constant Timeout = 5 * time.Second )
Functions ¶
func GenCerts ¶
func GenCerts(cfg ServerConfig) (err error)
GenCerts - Will generate etcd server and client certs from appropriate CA and key
Types ¶
type Client ¶ added in v0.0.4
type Client struct { Endpoints string CaFileName string ClientCertFileName string ClientKeyFileName string LockTTL time.Duration }
Client represents an etcd client configuration.
func (*Client) Get ¶ added in v0.0.4
Get - Will return: - The the string value for a given key if present - Will return an err for all other occasions
func (*Client) GetOrCreateLock ¶ added in v0.0.4
GetOrCreateLock obtains a lock (true) if the first client to create lock If TTL expired, will obtain lock (reset TTL) If TTL not expired will return false
func (*Client) OverWriteLock ¶ added in v0.0.4
OverWriteLock will delete and re-create a lock TODO: this needs to be done as a transaction!
func (*Client) PutTx ¶ added in v0.0.4
PutTx - Puts with a transaction (will NOT create new revision) Will ensure only a single version is ever stored. Returns error if key already existed
type Clienter ¶ added in v0.0.4
type Clienter interface { Get(key string) (value string, err error) GetOrCreateLock(key string, lockKeyTTL time.Duration) (mylock bool, err error) PutTx(key string, value string) (err error) Delete(key string) (err error) }
Clienter allows for mocking out this lib for testing