<commit_before>// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package bootstrap

import (
	"fmt"
	"time"

	"github.com/flynn/flynn/pkg/certgen"
)

type GenTLSCertAction struct {
	ID    string   `json:"id"`
	Hosts []string `json:"hosts"`
}

func init() {
	Register("gen-tls-cert", &GenTLSCertAction{})
}

type TLSCert struct {
	Cert string `json:"cert"`
	Pin  string `json:"pin"`

	PrivateKey string `json:"-"`
}

func (c *TLSCert) String() string {
	return fmt.Sprintf("pin: %s", c.Pin)
}

func (a *GenTLSCertAction) Run(s *State) (err error) {
	data := &TLSCert{}
	s.StepData[a.ID] = data
	data.Cert, data.PrivateKey, data.Pin, err = a.generateCert(s)
	return
}

func (a *GenTLSCertAction) generateCert(s *State) (cert, privKey, pin string, err error) {
	certOptions := certgen.Certificate{
		Lifespan: 365 * 24 * time.Hour,
		Hosts:    a.Hosts,
	}
	cert, privKey, pin, err = certgen.Generate(certOptions)
	return
}
<commit_msg>bootstrap: Remove stale copyright header from source<commit_after>package bootstrap

import (
	"fmt"
	"time"

	"github.com/flynn/flynn/pkg/certgen"
)

type GenTLSCertAction struct {
	ID    string   `json:"id"`
	Hosts []string `json:"hosts"`
}

func init() {
	Register("gen-tls-cert", &GenTLSCertAction{})
}

type TLSCert struct {
	Cert string `json:"cert"`
	Pin  string `json:"pin"`

	PrivateKey string `json:"-"`
}

func (c *TLSCert) String() string {
	return fmt.Sprintf("pin: %s", c.Pin)
}

func (a *GenTLSCertAction) Run(s *State) (err error) {
	data := &TLSCert{}
	s.StepData[a.ID] = data
	data.Cert, data.PrivateKey, data.Pin, err = a.generateCert(s)
	return
}

func (a *GenTLSCertAction) generateCert(s *State) (cert, privKey, pin string, err error) {
	certOptions := certgen.Certificate{
		Lifespan: 365 * 24 * time.Hour,
		Hosts:    a.Hosts,
	}
	cert, privKey, pin, err = certgen.Generate(certOptions)
	return
}

{'fraction_non_alphanumeric': 0.14926133469179828, 'fraction_numerical': 0.007131940906775344, 'mean_word_length': 4.223404255319149, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3606182', 'n_tokens_mistral': 762, 'n_tokens_neox': 734, 'n_words': 198}