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

Method UnmarshalCaddyfile

modules/caddytls/connpolicy.go:990–1029  ·  view source on GitHub ↗

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

(d *caddyfile.Dispenser)

Source from the content-addressed store, hash-verified

988
989// UnmarshalCaddyfile implements caddyfile.Unmarshaler.
990func (l *LeafCertClientAuth) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
991 d.NextArg()
992
993 // accommodate the use of one-liners
994 if d.CountRemainingArgs() > 1 {
995 d.NextArg()
996 modName := d.Val()
997 mod, err := caddyfile.UnmarshalModule(d, "tls.leaf_cert_loader."+modName)
998 if err != nil {
999 return d.WrapErr(err)
1000 }
1001 vMod, ok := mod.(LeafCertificateLoader)
1002 if !ok {
1003 return fmt.Errorf("leaf module '%s' is not a leaf certificate loader", vMod)
1004 }
1005 l.LeafCertificateLoadersRaw = append(
1006 l.LeafCertificateLoadersRaw,
1007 caddyconfig.JSONModuleObject(vMod, "loader", modName, nil),
1008 )
1009 return nil
1010 }
1011
1012 // accommodate the use of nested blocks
1013 for nesting := d.Nesting(); d.NextBlock(nesting); {
1014 modName := d.Val()
1015 mod, err := caddyfile.UnmarshalModule(d, "tls.leaf_cert_loader."+modName)
1016 if err != nil {
1017 return d.WrapErr(err)
1018 }
1019 vMod, ok := mod.(LeafCertificateLoader)
1020 if !ok {
1021 return fmt.Errorf("leaf module '%s' is not a leaf certificate loader", vMod)
1022 }
1023 l.LeafCertificateLoadersRaw = append(
1024 l.LeafCertificateLoadersRaw,
1025 caddyconfig.JSONModuleObject(vMod, "loader", modName, nil),
1026 )
1027 }
1028 return nil
1029}
1030
1031func (l LeafCertClientAuth) VerifyClientCertificate(rawCerts [][]byte, _ [][]*x509.Certificate) error {
1032 if len(rawCerts) == 0 {

Callers

nothing calls this directly

Calls 8

UnmarshalModuleFunction · 0.92
JSONModuleObjectFunction · 0.92
NextArgMethod · 0.80
CountRemainingArgsMethod · 0.80
ValMethod · 0.80
WrapErrMethod · 0.80
NestingMethod · 0.80
NextBlockMethod · 0.80

Tested by

no test coverage detected