Skip to content

Commit

Permalink
add version info
Browse files Browse the repository at this point in the history
  • Loading branch information
buffrr committed Dec 21, 2020
1 parent f1d6c95 commit 48110f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions cmd/letsdane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/pem"
"errors"
"flag"
"fmt"
"github.com/buffrr/hsig0"
"github.com/buffrr/letsdane"
rs "github.com/buffrr/letsdane/resolver"
Expand Down Expand Up @@ -36,6 +37,7 @@ var (
skipICANN = flag.Bool("skip-icann", false, "skip TLSA lookups for ICANN tlds and include them in the CA name constraints extension")
validity = flag.Duration("validity", time.Hour, "window of time generated DANE certificates are valid")
skipNameChecks = flag.Bool("skip-namechecks", false, "disable name checks when matching DANE-EE TLSA reocrds.")
version = flag.Bool("v", false, "show version")
)

func getConfPath() string {
Expand Down Expand Up @@ -250,6 +252,10 @@ func splitHostPortKey(addr string) (hostport string, key *hsig0.PublicKey, err e

func main() {
flag.Parse()
if *version {
fmt.Printf("Version %s\n", letsdane.Version)
return
}

ca, priv := loadCA()
if *output != "" {
Expand Down
9 changes: 6 additions & 3 deletions tunnel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ import (
"time"
)

const statusErr = "err"
const (
Version = "0.5"
statusErr = "err"
)

type Config struct {
Certificate *x509.Certificate
Expand Down Expand Up @@ -192,8 +195,8 @@ func httpError(w http.ResponseWriter, error string, code int) {
w.Header().Set("Content-Type", "text/html; charset=utf-8")
w.Header().Set("X-Content-Type-Options", "nosniff")
w.WriteHeader(code)
fmt.Fprintf(w, "<h1>%d %s</h1><p>%s</p>",
code, http.StatusText(code), html.EscapeString(error))
fmt.Fprintf(w, "<h1>%d %s</h1><p>%s</p><hr>letsdane/v%s",
code, http.StatusText(code), html.EscapeString(error), Version)
}

type rwStatusReader struct {
Expand Down

0 comments on commit 48110f6

Please sign in to comment.