mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-05-07 12:01:27 -05:00
ac8676fff4
* enhancement: enable icap preview mode and use a forked icap client which fixes tcp socket keepalive * enhancement: make use of human time for the icap timout config option * enhancement: update icap-client * enhancement: bump icap client library and deprecate ANTIVIRUS_ICAP_TIMEOUT env * chore: vendor icap library * enhancement: set preview size only if greater than 0 * Update services/antivirus/pkg/config/config.go Co-authored-by: Martin <github@diemattels.at> * enhancement: add changelog --------- Co-authored-by: Martin <github@diemattels.at>
34 lines
698 B
Go
34 lines
698 B
Go
package icapclient
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Config is the shared configuration for the icap client library
|
|
type Config struct {
|
|
ICAPConn ICAPConnConfig
|
|
}
|
|
|
|
// DefaultConfig returns the default configuration for the icap client library
|
|
func DefaultConfig() Config {
|
|
return Config{
|
|
ICAPConn: ICAPConnConfig{
|
|
Timeout: 15 * time.Second,
|
|
},
|
|
}
|
|
}
|
|
|
|
// ConfigOption is a function that configures the icap client
|
|
type ConfigOption func(*Config)
|
|
|
|
// WithICAPConnectionTimeout sets the timeout for the connection to the icap server
|
|
func WithICAPConnectionTimeout(timeout time.Duration) ConfigOption {
|
|
return func(cfg *Config) {
|
|
if timeout <= 0 {
|
|
return
|
|
}
|
|
|
|
cfg.ICAPConn.Timeout = timeout
|
|
}
|
|
}
|