New creates a new kontrol instance with the given version and config instance, and the default kontrol handlers. Publickey is used for validating tokens and privateKey is used for signing tokens. Public and private keys are RSA pem blocks that can be generated with the following command: openssl g
(conf *config.Config, version string)
| 138 | // NewWithoutHandlers(conf, version) |
| 139 | // |
| 140 | func New(conf *config.Config, version string) *Kontrol { |
| 141 | kontrol := NewWithoutHandlers(conf, version) |
| 142 | |
| 143 | kontrol.Kite.HandleFunc("register", kontrol.HandleRegister) |
| 144 | kontrol.Kite.HandleFunc("registerMachine", kontrol.HandleMachine).DisableAuthentication() |
| 145 | kontrol.Kite.HandleFunc("getKites", kontrol.HandleGetKites) |
| 146 | kontrol.Kite.HandleFunc("getToken", kontrol.HandleGetToken) |
| 147 | kontrol.Kite.HandleFunc("getKey", kontrol.HandleGetKey) |
| 148 | |
| 149 | kontrol.Kite.HandleHTTPFunc("/register", kontrol.HandleRegisterHTTP) |
| 150 | kontrol.Kite.HandleHTTPFunc("/heartbeat", kontrol.HandleHeartbeat) |
| 151 | |
| 152 | return kontrol |
| 153 | } |
| 154 | |
| 155 | // NewWithoutHandlers creates a new kontrol instance with the given version and config |
| 156 | // instance, but *without* the default handlers. If this is function is |