7 Commits

9 changed files with 50 additions and 34 deletions

1
.gitignore vendored
View File

@@ -1,2 +1,3 @@
dist/
tmp/
__*.exe

View File

@@ -5,7 +5,9 @@ before:
- go mod tidy
builds:
- env:
- ldflags:
- -X s1d3sw1ped/SteamCache2/version.Version={{.Version}}
env:
- CGO_ENABLED=0
goos:
- linux

9
.vscode/launch.json vendored
View File

@@ -11,9 +11,12 @@
"mode": "auto",
"program": "${workspaceFolder}/main.go",
"args": [
"--memory", "1G",
"--disk", "10G",
"--disk-path", "tmp/disk",
"--memory",
"1G",
"--disk",
"10G",
"--disk-path",
"tmp/disk",
],
}
]

View File

@@ -55,7 +55,8 @@ This will direct any requests to `lancache.steamcontent.com` to your SteamCache2
## License
This project is licensed. See the [LICENSE](LICENSE) file for details.
See the [LICENSE](LICENSE) file for details.
But just for clarity this covers all files in this project unless stated in the individual file.
## Acknowledgements

View File

@@ -1,24 +1,3 @@
/*
Copyright © 2025 s1d3sw1ped
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package cmd
import (

23
cmd/version.go Normal file
View File

@@ -0,0 +1,23 @@
package cmd
import (
"fmt"
"os"
"s1d3sw1ped/SteamCache2/version"
"github.com/spf13/cobra"
)
// versionCmd represents the version command
var versionCmd = &cobra.Command{
Use: "version",
Short: "prints the version of SteamCache2",
Long: `Prints the version of SteamCache2. This command is useful for checking the version of the application.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Fprintln(os.Stderr, "SteamCache2", version.Version)
},
}
func init() {
rootCmd.AddCommand(versionCmd)
}

View File

@@ -21,7 +21,10 @@ THE SOFTWARE.
*/
package main
import "s1d3sw1ped/SteamCache2/cmd"
import (
"s1d3sw1ped/SteamCache2/cmd"
_ "s1d3sw1ped/SteamCache2/version" // Import the version package for global version variable
)
func main() {
cmd.Execute()

View File

@@ -8,6 +8,7 @@ import (
"os"
"s1d3sw1ped/SteamCache2/steamcache/avgcachestate"
"s1d3sw1ped/SteamCache2/steamcache/logger"
"s1d3sw1ped/SteamCache2/version"
"s1d3sw1ped/SteamCache2/vfs"
"s1d3sw1ped/SteamCache2/vfs/cache"
"s1d3sw1ped/SteamCache2/vfs/cachestate"
@@ -81,7 +82,7 @@ func New(address string, memorySize string, memoryMultiplier int, diskSize strin
}
func (sc *SteamCache) Run() {
logger.Logger.Info().Str("address", sc.address).Msg("listening")
logger.Logger.Info().Str("address", sc.address).Str("version", version.Version).Msg("listening")
sc.mu.Lock()
sc.dirty = true

3
version/version.go Normal file
View File

@@ -0,0 +1,3 @@
package version
var Version string