Browse Source

En cours de développement

master
losyme 7 months ago
parent
commit
17537f7831
  1. 8
      server/options.go
  2. 8
      server/server.go

8
server/options.go

@ -82,6 +82,14 @@ func (po *Options) tlsConfig() (*tls.Config, error) {
type Option func(*Options)
func WithOptions(options *Options) Option {
return func(o *Options) {
if options != nil {
*o = *options
}
}
}
func WithAddr(addr string) Option {
return func(o *Options) {
o.Addr = addr

8
server/server.go

@ -23,14 +23,6 @@ func New(handler http.Handler, opts ...Option) (*Server, error) {
option(po)
}
return Build(handler, po)
}
func Build(handler http.Handler, po *Options) (*Server, error) {
if po == nil {
po = &Options{}
}
tlsConfig, err := po.tlsConfig()
if err != nil {
return nil, err

Loading…
Cancel
Save