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

Method UnmarshalCaddyfile

modules/caddytls/capools.go:95–112  ·  view source on GitHub ↗

Syntax: trust_pool inline { trust_der <base64_der_cert>... } The 'trust_der' directive can be specified multiple times.

(d *caddyfile.Dispenser)

Source from the content-addressed store, hash-verified

93//
94// The 'trust_der' directive can be specified multiple times.
95func (icp *InlineCAPool) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
96 d.Next() // consume module name
97 if d.CountRemainingArgs() > 0 {
98 return d.ArgErr()
99 }
100 for d.NextBlock(0) {
101 switch d.Val() {
102 case "trust_der":
103 icp.TrustedCACerts = append(icp.TrustedCACerts, d.RemainingArgs()...)
104 default:
105 return d.Errf("unrecognized directive: %s", d.Val())
106 }
107 }
108 if len(icp.TrustedCACerts) == 0 {
109 return d.Err("no certificates specified")
110 }
111 return nil
112}
113
114// CertPool implements CA.
115func (icp InlineCAPool) CertPool() *x509.CertPool {

Callers 1

Calls 8

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

Tested by 1