Skip to content

Commit

Permalink
version bump v1.3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
semihalev committed Jul 26, 2023
1 parent 92c6823 commit 28c7640
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 20 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
*.key
sdns
sdns.conf
sdns_*
coverage.out
blist_data
bl
access.log
vendor
9 changes: 8 additions & 1 deletion contrib/linux/sdns.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Config version, config and build versions can be different.
version = "1.2.0"
version = "1.3.2"

# Address to bind to for the DNS server
bind = ":53"
Expand All @@ -10,6 +10,9 @@ bind = ":53"
# Address to bind to for the DNS-over-HTTPS server
# binddoh = ":8053"

# Address to bind to for the DNS-over-QUIC server
# binddoq = ":853"

# TLS certificate file
# tlscertificate = "server.crt"

Expand Down Expand Up @@ -129,6 +132,10 @@ expire = 600
# Cache size (total records in cache)
cachesize = 256000

# Cache prefetch before expire. Default threshold is 10%, 0 for disabled.
# The threshold percent should be between 10% ~ 90%
prefetch = 10

# Maximum iteration depth for a query
maxdepth = 30

Expand Down
4 changes: 2 additions & 2 deletions contrib/linux/sdns.service
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Group=sdns
LimitNOFILE=131072
Restart=on-failure
RestartSec=10
Environment="SDNS_DEBUGNS=true"
Environment="SDNS_PPROF=true"
Environment="SDNS_DEBUGNS=false"
Environment="SDNS_PPROF=false"
WorkingDirectory=/var/lib/sdns
ExecStart=/usr/bin/sdns --config=/etc/sdns.conf
PermissionsStartOnly=true
Expand Down
35 changes: 20 additions & 15 deletions sdns.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"fmt"
"os"
"os/signal"
"runtime"
"runtime/debug"
"syscall"
"time"

Expand All @@ -19,33 +19,37 @@ import (
"github.com/semihalev/sdns/server"
)

const version = "1.3.1-rc1"
const version = "1.3.2"

var (
flagcfgpath = flag.String("config", "sdns.conf", "location of the config file, if config file not found, a config will generate")
flagprintver = flag.Bool("v", false, "show version information")
flagcfgpath string
flagprintver bool

cfg *config.Config
)

func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
flag.StringVar(&flagcfgpath, "config", "sdns.conf", "Location of the config file. If it doesn't exist, a new one will be generated.")
flag.StringVar(&flagcfgpath, "c", "sdns.conf", "Location of the config file. If it doesn't exist, a new one will be generated.")

flag.BoolVar(&flagprintver, "version", false, "Show the version of the program.")
flag.BoolVar(&flagprintver, "v", false, "Show the version of the program.")

flag.Usage = func() {
fmt.Fprintf(os.Stderr, "Usage: %s [OPTIONS]\n\n", os.Args[0])
fmt.Fprintln(os.Stderr, "Options:")
flag.PrintDefaults()
fmt.Fprintln(os.Stderr, "")
fmt.Fprintln(os.Stderr, "Example:")
fmt.Fprintf(os.Stderr, "%s -config=sdns.conf\n", os.Args[0])
fmt.Fprintln(os.Stderr, "")
fmt.Fprintf(os.Stderr, "Usage:\n sdns [OPTIONS]\n\n")
fmt.Fprintf(os.Stderr, "Options:\n")
fmt.Fprintf(os.Stderr, " -c, --config PATH\tLocation of the config file. If it doesn't exist, a new one will be generated.\n")
fmt.Fprintf(os.Stderr, " -v, --version\t\tShow the version of the program.\n")
fmt.Fprintf(os.Stderr, " -h, --help\t\tShow this message and exit.\n\n")
fmt.Fprintf(os.Stderr, "Example:\n")
fmt.Fprintf(os.Stderr, " sdns -c sdns.conf\n\n")
}
}

func setup() {
var err error

if cfg, err = config.Load(*flagcfgpath, version); err != nil {
if cfg, err = config.Load(flagcfgpath, version); err != nil {
log.Crit("Config loading failed", "error", err.Error())
}

Expand Down Expand Up @@ -77,8 +81,9 @@ func run(ctx context.Context) *server.Server {
func main() {
flag.Parse()

if *flagprintver {
println("SDNS v" + version)
if flagprintver {
buildInfo, _ := debug.ReadBuildInfo()
fmt.Fprintf(os.Stderr, "SDNS v%s built with %s\n", version, buildInfo.GoVersion)
os.Exit(0)
}

Expand Down

0 comments on commit 28c7640

Please sign in to comment.