INNER CODE UNIT · Go

getBootstrapper

spegel-org/spegel · main.go:337

func getBootstrapper(cfg BootstrapConfig) (libp2p.Bootstrapper, error) { //nolint: ireturn // Return type can be different structs.
	switch cfg.BootstrapKind {
	case "dns":
		return libp2p.NewDNSBootstrapper(cfg.DNSBootstrapDomain), nil
	case "http":
		pool, cert, err := httpx.LoadCerts(cfg.HTTPBootstrapCertDir)
		if err != nil {
			return nil, err
		}
		return libp2p.NewHTTPBootstrapper(cfg.HTTPBootstrapURL, pool, cert)
	case "static":
		return libp2p.NewStaticBootstrapperFromStrings(cfg.StaticBootstrapPeers)
	default:
		return nil, fmt.Errorf("unknown bootstrap kind %s", cfg.BootstrapKind)
	}
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…