feat: add additional configuration functions
This commit is contained in:
parent
6e1aca1622
commit
1fc335418b
|
@ -31,6 +31,12 @@ func DefaultClientConfig() *ClientConfig {
|
|||
}
|
||||
}
|
||||
|
||||
func WithClientServerAddress(addr string) ClientConfigFunc {
|
||||
return func(conf *ClientConfig) {
|
||||
conf.ServerAddress = addr
|
||||
}
|
||||
}
|
||||
|
||||
func WithClientCredentials(credentials interface{}) ClientConfigFunc {
|
||||
return func(conf *ClientConfig) {
|
||||
conf.Credentials = credentials
|
||||
|
|
|
@ -37,6 +37,12 @@ func DefaultServerConfig() *ServerConfig {
|
|||
|
||||
type ServerConfigFunc func(c *ServerConfig)
|
||||
|
||||
func WithServerAddress(address string) ServerConfigFunc {
|
||||
return func(conf *ServerConfig) {
|
||||
conf.Address = address
|
||||
}
|
||||
}
|
||||
|
||||
func WithServerAESBlockCrypt(pass, salt string) ServerConfigFunc {
|
||||
return func(conf *ServerConfig) {
|
||||
key := pbkdf2.Key([]byte(pass), []byte(salt), 1024, 32, sha1.New)
|
||||
|
|
Loading…
Reference in New Issue