1234567891011121314151617181920212223242526272829303132333435 |
- package mhayaConnector
- import (
- clog "github.com/mhaya/logger"
- )
- type (
- Options struct {
- address string
- certFile string
- keyFile string
- chanSize int
- }
- Option func(*Options)
- )
- func WithCert(certFile, keyFile string) Option {
- return func(o *Options) {
- if certFile != "" && keyFile != "" {
- o.certFile = certFile
- o.keyFile = keyFile
- } else {
- clog.Errorf("Cert config error.[cert = %s,key = %s]", certFile, keyFile)
- }
- }
- }
- func WithChanSize(size int) Option {
- return func(o *Options) {
- if size > 1 {
- o.chanSize = size
- }
- }
- }
|