Files
opencloud/vendor/github.com/egirna/icap-client/config.go
T
Florian Schade ac8676fff4 enhancement: enable icap preview mode and fix client according to the spec (#8062)
* 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>
2024-01-05 20:52:26 +01:00

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
}
}