Skip to content

Commit

Permalink
Updated the Copyright Year string
Browse files Browse the repository at this point in the history
Added a version command line arg
  • Loading branch information
iDigitalFlame committed Jan 3, 2023
1 parent 3eb872a commit 3578fe2
Show file tree
Hide file tree
Showing 31 changed files with 72 additions and 35 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@

# Dependency directories (remove the comment below to include it)
# vendor/

version.go
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Golang based OpenVPN manager and server.

```[text]
Akcss - OpenVPN Manager
iDigitalFlame 2021 - 2022 (idigitalflame.com)
iDigitalFlame 2021 - 2023 (idigitalflame.com)
General
-c Configuration file path, defaults
Expand Down
3 changes: 2 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/bash
# Copyright (C) 2021 - 2022 iDigitalFlame
# Copyright (C) 2021 - 2023 iDigitalFlame
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -21,6 +21,7 @@ if [ $# -ge 1 ]; then
fi

echo "Building.."
go generate
go build -buildvcs=false -trimpath -ldflags "-s -w" -o "$output" cmd/main.go

which upx &> /dev/null
Expand Down
2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
9 changes: 7 additions & 2 deletions command.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -27,6 +27,8 @@ import (
"github.com/iDigitalFlame/akcss/xerr"
)

//go:generate bash version.sh

const (
socket = "/var/run/akcss.sock"
socketTCP = "127.0.0.1:9090"
Expand All @@ -46,7 +48,10 @@ var (
// parse the flags and create the Akcss instance.
func Start() {
if f := new(flags).setup(); f.valid() {
if err := f.exec(); err != nil {
if f.Args.Version {
os.Stdout.WriteString("Akcss: " + buildVersion + "\n")
os.Exit(0)
} else if err := f.exec(); err != nil {
os.Stderr.WriteString(err.Error() + "!\n")
os.Exit(1)
}
Expand Down
5 changes: 3 additions & 2 deletions doc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -39,13 +39,14 @@ const config = `{
`

const usage = `Akcss - OpenVPN Manager
iDigitalFlame 2021 - 2022 (idigitalflame.com)
iDigitalFlame 2021 - 2023 (idigitalflame.com)
General
-c Configuration file path, defaults
to "akcss.conf" or "${AKCSS_CONF}".
-r Send a reload signal to the daemon.
-d Print default config and exit.
-V Print version string and exit.
--no-fault Ignore startup errors and continue anyway.
Applies only to daemon mode and allows fixing
configuration errors.
Expand Down
13 changes: 8 additions & 5 deletions flag.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -48,9 +48,10 @@ type flags struct {
Push bool
Config bool
}
Force bool
Fault bool
Soft bool
Force bool
Fault bool
Soft bool
Version bool
}
Extra []string
details
Expand Down Expand Up @@ -243,7 +244,8 @@ func (f *flags) valid() bool {
f.Command.Option.New || f.Command.Option.List || f.Command.Option.Delete ||
f.Command.Option.Client.New || f.Command.Option.Client.List || f.Command.Option.Client.Delete ||
f.Command.Client.New || f.Command.Client.Delete ||
f.Command.Notify.New || f.Command.Notify.List || f.Command.Notify.Delete || f.Command.Config
f.Command.Notify.New || f.Command.Notify.List || f.Command.Notify.Delete || f.Command.Config ||
f.Args.Version
}
func (f *flags) setup() *flags {
f.FlagSet = flag.NewFlagSet("Akcss - OpenVPN Manager", flag.ContinueOnError)
Expand All @@ -255,6 +257,7 @@ func (f *flags) setup() *flags {
f.BoolVar(&f.Command.Daemon, "daemon", false, "")
f.BoolVar(&f.Command.Config, "d", false, "")
f.BoolVar(&f.Args.Fault, "no-fault", false, "")
f.BoolVar(&f.Args.Version, "V", false, "")

// Boolean Multi Pointers
var s, r = flagBooleans{&f.Command.Start, &f.Restart}, flagBooleans{&f.Command.Restart, &f.Restart}
Expand Down
2 changes: 1 addition & 1 deletion mail.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion manager.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion message.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion pki/authority.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion pki/certfificate.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion pki/vars.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion process.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion systemd/akcss-crl.service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021 - 2022 iDigitalFlame
# Copyright (C) 2021 - 2023 iDigitalFlame
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion systemd/akcss-crl.timer
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021 - 2022 iDigitalFlame
# Copyright (C) 2021 - 2023 iDigitalFlame
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion systemd/akcss.service
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2021 - 2022 iDigitalFlame
# Copyright (C) 2021 - 2023 iDigitalFlame
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion userid/lookup_nix.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build !windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion userid/lookup_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion userid/z_no_priv.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build !rootok && !windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion userid/z_priv.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build rootok && !windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion util.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
25 changes: 25 additions & 0 deletions version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/bash
# Copyright (C) 2021 - 2023 iDigitalFlame
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#

cat <<EOF> "version.go"
// Code generated by go generate DO NOT EDIT.
package akcss
const buildVersion = "$(date +%F)_$(git rev-parse --short HEAD 2> /dev/null || echo "non-git")"
EOF
2 changes: 1 addition & 1 deletion vpn/notify.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion vpn/server.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion vpn/vars.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion xerr/error.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion z_id_nix.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build !windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion z_id_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build windows

// Copyright (C) 2021 - 2022 iDigitalFlame
// Copyright (C) 2021 - 2023 iDigitalFlame
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
Expand Down

0 comments on commit 3578fe2

Please sign in to comment.