MCPcopy
hub / github.com/caddyserver/caddy / UnmarshalCaddyfile

Method UnmarshalCaddyfile

modules/caddytls/capools.go:735–759  ·  view source on GitHub ↗

Syntax: trust_pool http [<endpoints...>] { endpoints <endpoints...> tls <tls_config> } tls_config: ca <ca_module> insecure_skip_verify handshake_timeout <duration> server_name <name> renegotiation <never|once|freely> <ca_module> is the name of the CA module to source the tr

(d *caddyfile.Dispenser)

Source from the content-addressed store, hash-verified

733//
734// certificate pool and follows the syntax of the named CA module.
735func (hcp *HTTPCertPool) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
736 d.Next() // consume module name
737 hcp.Endpoints = append(hcp.Endpoints, d.RemainingArgs()...)
738 for nesting := d.Nesting(); d.NextBlock(nesting); {
739 switch d.Val() {
740 case "endpoints":
741 if d.CountRemainingArgs() == 0 {
742 return d.ArgErr()
743 }
744 hcp.Endpoints = append(hcp.Endpoints, d.RemainingArgs()...)
745 case "tls":
746 if hcp.TLS != nil {
747 return d.Err("tls block already defined")
748 }
749 hcp.TLS = new(TLSConfig)
750 if err := hcp.TLS.unmarshalCaddyfile(d); err != nil {
751 return err
752 }
753 default:
754 return d.Errf("unrecognized directive: %s", d.Val())
755 }
756 }
757
758 return nil
759}
760
761// report error if the endpoints are not valid URLs
762func (hcp HTTPCertPool) Validate() (err error) {

Callers 1

Calls 10

RemainingArgsMethod · 0.80
NestingMethod · 0.80
NextBlockMethod · 0.80
ValMethod · 0.80
CountRemainingArgsMethod · 0.80
ArgErrMethod · 0.80
ErrMethod · 0.80
unmarshalCaddyfileMethod · 0.80
ErrfMethod · 0.80
NextMethod · 0.65

Tested by 1