github.com/Cloud-Foundations/Dominator@v0.3.4/lib/srpc/setupserver/api.go (about) 1 /* 2 Package setupserver assists in setting up TLS credentials for a server. 3 4 Package setupserver provides convenience functions for setting up a server 5 with TLS credentials. 6 7 The package loads client and server certificates from files and registers 8 them with the lib/srpc package. The following command-line flags are 9 registered with the standard flag package: 10 -caFile: Name of file containing the root of trust 11 -certFile: Name of file containing the SSL certificate 12 -keyFile: Name of file containing the SSL key 13 */ 14 package setupserver 15 16 import ( 17 "github.com/Cloud-Foundations/Dominator/lib/log" 18 ) 19 20 type Params struct { 21 ClientOnly bool // If true, only register client certificate and key. 22 FailIfExpired bool // If true, fail if certificate not yet valid or expired. 23 Logger log.DebugLogger 24 } 25 26 func SetupTls() error { 27 return setupTls(Params{}) 28 } 29 30 func SetupTlsClientOnly() error { 31 return setupTls(Params{ClientOnly: true}) 32 } 33 34 func SetupTlsWithParams(params Params) error { 35 return setupTls(params) 36 }