mirror of
https://github.com/gocsaf/csaf.git
synced 2025-12-22 18:15:42 +01:00
Code documentation
This commit is contained in:
parent
aa60e8f245
commit
41a2d50773
2 changed files with 8 additions and 0 deletions
|
|
@ -38,6 +38,8 @@ func errCheck(err error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// writeJSON writes the JSON encoding of the given report to the given stream.
|
||||||
|
// It returns nil, otherwise an error.
|
||||||
func writeJSON(report *Report, w io.WriteCloser) error {
|
func writeJSON(report *Report, w io.WriteCloser) error {
|
||||||
enc := json.NewEncoder(w)
|
enc := json.NewEncoder(w)
|
||||||
enc.SetIndent("", " ")
|
enc.SetIndent("", " ")
|
||||||
|
|
@ -48,6 +50,8 @@ func writeJSON(report *Report, w io.WriteCloser) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// writeHTML writes the given report to the given writer, it uses the template
|
||||||
|
// in the "reportHTML" variable. It returns nil, otherwise an error.
|
||||||
func writeHTML(report *Report, w io.WriteCloser) error {
|
func writeHTML(report *Report, w io.WriteCloser) error {
|
||||||
tmpl, err := template.New("Report HTML").Parse(reportHTML)
|
tmpl, err := template.New("Report HTML").Parse(reportHTML)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -72,6 +76,8 @@ type nopCloser struct{ io.Writer }
|
||||||
|
|
||||||
func (nc *nopCloser) Close() error { return nil }
|
func (nc *nopCloser) Close() error { return nil }
|
||||||
|
|
||||||
|
// writeReport defines where to write the report according to the "output" flag options.
|
||||||
|
// It calls also the "writeJSON" or "writeHTML" function according to the "format" flag option.
|
||||||
func writeReport(report *Report, opts *options) error {
|
func writeReport(report *Report, opts *options) error {
|
||||||
|
|
||||||
var w io.WriteCloser
|
var w io.WriteCloser
|
||||||
|
|
|
||||||
|
|
@ -182,6 +182,8 @@ func (p *processor) checkDomain(domain string) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// checkTLS parses the given URL to check its schema, as a result set
|
||||||
|
// the value of "noneTLS" field if it is not HTTPS.
|
||||||
func (p *processor) checkTLS(u string) {
|
func (p *processor) checkTLS(u string) {
|
||||||
if p.noneTLS == nil {
|
if p.noneTLS == nil {
|
||||||
p.noneTLS = map[string]struct{}{}
|
p.noneTLS = map[string]struct{}{}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue