From 783ae72d9b7e4024c1761421b87fa6b9e852ac54 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 3 Mar 2023 21:56:21 +0800 Subject: [PATCH 001/132] Initial commit --- .gitignore | 6 +-- Cargo.toml | 6 +++ LICENSE | 21 --------- README.md | 31 ------------- go.mod | 13 ------ go.sum | 11 ----- ips.go | 126 ---------------------------------------------------- main.go | 93 -------------------------------------- pinger.go | 67 ---------------------------- scanner.go | 84 ----------------------------------- src/main.rs | 3 ++ 11 files changed, 10 insertions(+), 451 deletions(-) create mode 100644 Cargo.toml delete mode 100644 LICENSE delete mode 100644 README.md delete mode 100644 go.mod delete mode 100644 go.sum delete mode 100644 ips.go delete mode 100644 main.go delete mode 100644 pinger.go delete mode 100644 scanner.go create mode 100644 src/main.rs diff --git a/.gitignore b/.gitignore index 33d1342..ea8c4bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1 @@ -openheimer -openheimer.db -openheimer.log -ips -old-db +/target diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e1d591a --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "openheimer" +version = "0.1.0" +edition = "2021" + +[dependencies] diff --git a/LICENSE b/LICENSE deleted file mode 100644 index b67f6c1..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2022 Ryan - -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. diff --git a/README.md b/README.md deleted file mode 100644 index ca178f3..0000000 --- a/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# OpenHeimer -OpenHeimer is the (unofficial) open source version of the Copenheimer project. It scans all the IPv4 addresses in order to find Minecraft servers exposed to the internet. The original version is currently closed-source and not available to anyone else, that's why this version exists. - -:rocket: Capable of scanning up to 16,000 IP addresses per second, finishing everything in just 3 days! :rocket: - -## Usage -Run `openheimer -help` to see a list of commands -``` -Usage of ./openheimer: - -database string - The database to store the results in (default "openheimer.db") - -ipFile string - The file to extract IP addresses from - -logFile string - The file to store the logs in (default "openheimer.log") - -maxPingWorkers int - The maximum amount of workers to ping IPs (default 4000) - -maxScanWorkers int - The maximum amount of workers to scan IPs (default 1000) - -startingIP string - The IP address to start scanning from (default "1.0.0.0") - -timeout int - The amount of seconds to wait before timing out (default 5) - -verbose - Display everything that's happening - -version - Display the current version of OpenHeimer -``` -Note: `maxPingWorkers` are the amount of workers to use to check for open ports. `maxScanWorkers` are the amount of workers to use to check if an IP has a valid Minecraft server. Normally you would increase `maxPingWorkers` to ping IP addresses faster, but when you're scanning IP addresses from a file (produced by masscan for example), you should increase `maxScanWorkers`. - -If you would like to modify or use this repository (including its code) in your own project, please be sure to credit! diff --git a/go.mod b/go.mod deleted file mode 100644 index af2c0a8..0000000 --- a/go.mod +++ /dev/null @@ -1,13 +0,0 @@ -module github.com/ErrorNoInternet/openheimer - -go 1.18 - -require ( - github.com/Raqbit/mc-pinger v0.2.3 - github.com/peterbourgon/diskv/v3 v3.0.1 -) - -require ( - github.com/google/btree v1.1.2 // indirect - github.com/pires/go-proxyproto v0.6.2 // indirect -) diff --git a/go.sum b/go.sum deleted file mode 100644 index 67e3d70..0000000 --- a/go.sum +++ /dev/null @@ -1,11 +0,0 @@ -github.com/Raqbit/mc-pinger v0.2.3 h1:CpXd6s3V3Nduy8AWngg18qKwsunLAilRDZqC9F9/KDg= -github.com/Raqbit/mc-pinger v0.2.3/go.mod h1:3BtpUQAShwS0ClpL0Mfs8Lr4W42tOOCbtMtw9mw3Kng= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= -github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/peterbourgon/diskv/v3 v3.0.1 h1:x06SQA46+PKIUftmEujdwSEpIx8kR+M9eLYsUxeYveU= -github.com/peterbourgon/diskv/v3 v3.0.1/go.mod h1:kJ5Ny7vLdARGU3WUuy6uzO6T0nb/2gWcT1JiBvRmb5o= -github.com/pires/go-proxyproto v0.6.0 h1:cLJUPnuQdiNf7P/wbeOKmM1khVdaMgTFDLj8h9ZrVYk= -github.com/pires/go-proxyproto v0.6.0/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= -github.com/pires/go-proxyproto v0.6.2 h1:KAZ7UteSOt6urjme6ZldyFm4wDe/z0ZUP0Yv0Dos0d8= -github.com/pires/go-proxyproto v0.6.2/go.mod h1:Odh9VFOZJCf9G8cLW5o435Xf1J95Jw9Gw5rnCjcwzAY= diff --git a/ips.go b/ips.go deleted file mode 100644 index 1f0447d..0000000 --- a/ips.go +++ /dev/null @@ -1,126 +0,0 @@ -package main - -import ( - "fmt" - "io/ioutil" - "log" - "strconv" - "strings" - "time" -) - -func readFromFile(filePath string, outputChannel chan string) int { - log.Printf("Reading IPs from %v...\n", filePath) - fileData, err := ioutil.ReadFile(filePath) - if err != nil { - log.Fatalf("Unable to read file: %v\n", err.Error()) - return 1 - } - ips := strings.Split(strings.TrimSpace(string(fileData)), "\n") - ok, index := validateIps(ips) - if !ok { - log.Fatalf("The IP address on line %v is invalid!\n", index+1) - return 1 - } - log.Printf("Successfully read %v IP addresses from file\n", len(ips)) - for _, ip := range ips { - if strings.TrimSpace(ip) != "" { - outputChannel <- ip - } - } - - time.Sleep(100 * time.Millisecond) - outputChannel <- "end" - return 0 -} - -func generateIps(startingIp string, outputChannel chan string) int { - log.Printf("Generating IPs from %v...\n", startingIp) - ok, _ := validateIps([]string{startingIp}) - if !ok { - log.Println("The starting IP address you specified is invalid!") - return 1 - } - - segments := strings.Split(startingIp, ".") - segmentA, _ := strconv.Atoi(segments[0]) - segmentB, _ := strconv.Atoi(segments[1]) - segmentC, _ := strconv.Atoi(segments[2]) - segmentD, _ := strconv.Atoi(segments[3]) - for { - serverIp := fmt.Sprintf("%v.%v.%v.%v", segmentA, segmentB, segmentC, segmentD) - outputChannel <- serverIp - - segmentD += 1 - if segmentD > 255 { - segmentD = 0 - segmentC += 1 - if segmentC > 255 { - segmentC = 0 - segmentB += 1 - log.Printf("Scanning IP range %v.%v.*.*...\n", segmentA, segmentB) - if segmentB > 255 { - segmentB = 0 - segmentA += 1 - if segmentA > 255 { - break - } - } - } - } - } - - time.Sleep(100 * time.Millisecond) - outputChannel <- "end" - return 0 -} - -func validateIps(ips []string) (bool, int) { - for index, ip := range ips { - if strings.TrimSpace(ip) == "" { - continue - } - if strings.Contains(ip, ":") { - addressSegments := strings.Split(ip, ":") - ip = addressSegments[0] - port := addressSegments[1] - - segments := strings.Split(ip, ".") - if len(segments) != 4 { - return false, index - } - for _, segment := range segments { - number, err := strconv.Atoi(segment) - if err != nil { - return false, index - } - if number < 0 || number > 255 { - return false, index - } - } - - number, err := strconv.ParseUint(port, 10, 16) - if err != nil { - return false, index - } - if number < 0 || number > 65535 { - return false, index - } - } else { - segments := strings.Split(ip, ".") - if len(segments) != 4 { - return false, index - } - for _, segment := range segments { - number, err := strconv.Atoi(segment) - if err != nil { - return false, index - } - if number < 0 || number > 255 { - return false, index - } - } - } - } - return true, -1 -} diff --git a/main.go b/main.go deleted file mode 100644 index 50ee51b..0000000 --- a/main.go +++ /dev/null @@ -1,93 +0,0 @@ -package main - -import ( - "flag" - "fmt" - "io" - "log" - "os" - "time" - - "github.com/peterbourgon/diskv/v3" -) - -var ( - version string = "0.1.1" - database *diskv.Diskv - addressChannel chan string = make(chan string) - scanQueue chan string = make(chan string) - pingWorkers int - scanWorkers int - pinging bool - scanning bool - pinged int64 - scanned int64 - valid int64 - - databasePath string - logFile string - ipFile string - startingIp string - timeout int - maxPingWorkers int - maxScanWorkers int - verbose *bool -) - -func main() { - flag.StringVar(&databasePath, "database", "openheimer.db", "The database to store the results in") - flag.StringVar(&logFile, "logFile", "openheimer.log", "The file to store the logs in") - flag.StringVar(&ipFile, "ipFile", "", "The file to extract IP addresses from") - flag.StringVar(&startingIp, "startingIp", "1.0.0.0", "The IP address to start scanning from") - flag.IntVar(&timeout, "timeout", 5, "The amount of seconds to wait before timing out") - flag.IntVar(&maxPingWorkers, "maxPingWorkers", 4000, "The maximum amount of workers to ping IPs") - flag.IntVar(&maxScanWorkers, "maxScanWorkers", 1000, "The maximum amount of workers to scan IPs") - verbose = flag.Bool("verbose", false, "Display everything that's happening") - displayVersion := flag.Bool("version", false, "Display the current version of OpenHeimer") - flag.Parse() - - if *displayVersion { - fmt.Printf("OpenHeimer v%v\n", version) - return - } - - startTime := time.Now().Unix() - file, err := os.Create(logFile) - if err != nil { - log.Fatalf("Unable to create %v: %v\n", logFile, err.Error()) - return - } - log.SetOutput(io.MultiWriter(os.Stdout, file)) - flatTransform := func(s string) []string { return []string{} } - database = diskv.New(diskv.Options{ - BasePath: databasePath, - Transform: flatTransform, - CacheSizeMax: 1024 * 1024, - }) - go displayStatus() - go pingIps() - go scanIps() - if ipFile != "" { - result := readFromFile(ipFile, addressChannel) - if result == 1 { - return - } - } else { - result := generateIps(startingIp, addressChannel) - if result == 1 { - return - } - } - - for pinging || scanning { - time.Sleep(1 * time.Second) - } - log.Printf("Done! Finished in %v seconds. Pinged: %v, Scanned: %v, Valid: %v.\n", time.Now().Unix()-startTime, pinged, scanned, valid) -} - -func displayStatus() { - for { - time.Sleep(5 * time.Second) - log.Printf("Pinged: %v, Scanned: %v, Valid: %v\n", pinged, scanned, valid) - } -} diff --git a/pinger.go b/pinger.go deleted file mode 100644 index 5819185..0000000 --- a/pinger.go +++ /dev/null @@ -1,67 +0,0 @@ -package main - -import ( - "fmt" - "log" - "net" - "strings" - "sync" - "time" -) - -func pingIps() { - pinging = true - var mutex sync.Mutex - if *verbose { - log.Println("Starting IP pinger...") - } - - for { - for pingWorkers >= maxPingWorkers { - time.Sleep(100 * time.Millisecond) - } - - address := <-addressChannel - if address == "end" { - break - } - ip, port := address, "25565" - if strings.Contains(address, ":") { - segments := strings.Split(address, ":") - ip = segments[0] - port = segments[1] - } - go pingIp(ip, port, &mutex) - mutex.Lock() - pingWorkers++ - pinged++ - mutex.Unlock() - } - - for pingWorkers > 0 { - time.Sleep(1 * time.Millisecond) - } - scanQueue <- "end" - pinging = false -} - -func pingIp(ip string, port string, mutex *sync.Mutex) { - connection, err := net.DialTimeout("tcp", net.JoinHostPort(ip, port), time.Second*time.Duration(timeout)) - if err != nil { - if *verbose { - log.Printf("Unable to ping %v:%v: %v\n", ip, port, err.Error()) - } - mutex.Lock() - pingWorkers-- - mutex.Unlock() - return - } - if connection != nil { - defer connection.Close() - scanQueue <- fmt.Sprintf("%v:%v", ip, port) - } - - mutex.Lock() - pingWorkers-- - mutex.Unlock() -} diff --git a/scanner.go b/scanner.go deleted file mode 100644 index 17514fd..0000000 --- a/scanner.go +++ /dev/null @@ -1,84 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "log" - "strconv" - "strings" - "sync" - "time" - - mcpinger "github.com/Raqbit/mc-pinger" -) - -func scanIps() { - scanning = true - var mutex sync.Mutex - if *verbose { - log.Println("Starting IP scanner...") - } - - for { - for scanWorkers >= maxScanWorkers { - time.Sleep(100 * time.Millisecond) - } - - address := <-scanQueue - if address == "end" { - break - } - ip := address - var port uint16 = 25565 - if strings.Contains(address, ":") { - segments := strings.Split(address, ":") - ip = segments[0] - parsedPort, _ := strconv.ParseUint(segments[1], 10, 16) - port = uint16(parsedPort) - } - go scanIp(ip, port, &mutex) - mutex.Lock() - scanWorkers++ - scanned++ - mutex.Unlock() - } - - for scanWorkers > 0 { - time.Sleep(1 * time.Millisecond) - } - scanning = false -} - -func scanIp(ip string, port uint16, mutex *sync.Mutex) { - if *verbose { - log.Printf("Scanning %v:%v...\n", ip, port) - } - response, err := mcpinger.New(ip, port, mcpinger.WithTimeout(time.Second*time.Duration(timeout))).Ping() - if err != nil { - if *verbose { - log.Printf("Unable to scan %v:%v: %v\n", ip, port, err.Error()) - } - mutex.Lock() - scanWorkers-- - mutex.Unlock() - return - } - jsonObject, err := json.Marshal(response) - if err != nil { - log.Printf("Unable to marshal server response: %v\n", err.Error()) - mutex.Lock() - scanWorkers-- - mutex.Unlock() - return - } - log.Printf("Found Minecraft server at %v:%v\n", ip, port) - err = database.Write(fmt.Sprintf("%v:%v", ip, port), jsonObject) - if err != nil { - log.Printf("Unable to write to database: %v\n", err.Error()) - } - - mutex.Lock() - scanWorkers-- - valid++ - mutex.Unlock() -} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..e7a11a9 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} From d765e48144e686e6f636df870b76028b4e3d4ff9 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 3 Mar 2023 22:06:17 +0800 Subject: [PATCH 002/132] Add new README --- README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..fcf4128 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# OpenHeimer +An open-source remake of the Copenheimer project. Scan the entire internet for exposed Minecraft servers! From e9dc41a08cec3ba4e02df7fca6ec7a28639f4e30 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sat, 4 Mar 2023 13:23:35 +0800 Subject: [PATCH 003/132] Add GPL license --- LICENSE | 675 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 675 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..53d1f3d --- /dev/null +++ b/LICENSE @@ -0,0 +1,675 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + 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 + (at your option) 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 . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + From f2cb9a334421326700c260dbc05d1f9d8b160aca Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:20:07 +0800 Subject: [PATCH 004/132] Add basic dependencies --- Cargo.lock | 1341 ++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 4 + 2 files changed, 1345 insertions(+) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..ae2660d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1341 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "anstream" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-wincon", + "concolor-override", + "concolor-query", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" + +[[package]] +name = "anstyle-parse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-wincon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +dependencies = [ + "anstyle", + "windows-sys", +] + +[[package]] +name = "async-trait" +version = "0.1.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + +[[package]] +name = "atoi" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base64" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" + +[[package]] +name = "cc" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "clap" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" +dependencies = [ + "clap_builder", +] + +[[package]] +name = "clap_builder" +version = "4.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +dependencies = [ + "anstream", + "anstyle", + "bitflags", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_lex" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" + +[[package]] +name = "concolor-override" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" + +[[package]] +name = "concolor-query" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" +dependencies = [ + "windows-sys", +] + +[[package]] +name = "cpufeatures" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "either" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" + +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.8", +] + +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" + +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.11.2", +] + +[[package]] +name = "futures-sink" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" + +[[package]] +name = "futures-task" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" + +[[package]] +name = "futures-util" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashlink" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "io-lifetimes" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" + +[[package]] +name = "js-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" + +[[package]] +name = "libsqlite3-sys" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + +[[package]] +name = "lock_api" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "memchr" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +dependencies = [ + "libc", + "log", + "wasi", + "windows-sys", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "num-traits" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +dependencies = [ + "hermit-abi 0.2.6", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "openheimer" +version = "0.1.0" +dependencies = [ + "async-trait", + "clap", + "sqlx", + "tokio", +] + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.6", +] + +[[package]] +name = "parking_lot" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.7", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "paste" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" + +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" + +[[package]] +name = "proc-macro2" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustix" +version = "0.37.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + +[[package]] +name = "rustls" +version = "0.20.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +dependencies = [ + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +dependencies = [ + "base64", +] + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + +[[package]] +name = "socket2" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "sqlformat" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" +dependencies = [ + "sqlx-core", + "sqlx-macros", +] + +[[package]] +name = "sqlx-core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" +dependencies = [ + "ahash", + "atoi", + "bitflags", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "dotenvy", + "either", + "event-listener", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "hashlink", + "hex", + "indexmap", + "itoa", + "libc", + "libsqlite3-sys", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rustls", + "rustls-pemfile", + "sha2", + "smallvec", + "sqlformat", + "sqlx-rt", + "stringprep", + "thiserror", + "tokio-stream", + "url", + "webpki-roots", +] + +[[package]] +name = "sqlx-macros" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" +dependencies = [ + "dotenvy", + "either", + "heck", + "once_cell", + "proc-macro2", + "quote", + "sha2", + "sqlx-core", + "sqlx-rt", + "syn 1.0.109", + "url", +] + +[[package]] +name = "sqlx-rt" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" +dependencies = [ + "once_cell", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "stringprep" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +dependencies = [ + "autocfg", + "bytes", + "libc", + "mio", + "num_cpus", + "parking_lot 0.12.1", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys", +] + +[[package]] +name = "tokio-macros" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "unicode-normalization" +version = "0.1.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.84" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" + +[[package]] +name = "web-sys" +version = "0.3.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +dependencies = [ + "webpki", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" diff --git a/Cargo.toml b/Cargo.toml index e1d591a..fd0faf4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,3 +4,7 @@ version = "0.1.0" edition = "2021" [dependencies] +clap = "4.2" +tokio = { version = "1.0", features = ["full"] } +sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } +async-trait = "0.1.68" From 93f681871fa35aee1f82346910e378b2f5d437ef Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:20:20 +0800 Subject: [PATCH 005/132] hello, openheimer! --- src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index e7a11a9..13c1b86 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,6 @@ +mod database; +mod minecraft; + fn main() { - println!("Hello, world!"); + println!("hello, openheimer!") } From fab1c3f056dc482ffd35af70776f1372944d9c3a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:20:41 +0800 Subject: [PATCH 006/132] Add database trait --- src/database/mod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 src/database/mod.rs diff --git a/src/database/mod.rs b/src/database/mod.rs new file mode 100644 index 0000000..fe87b68 --- /dev/null +++ b/src/database/mod.rs @@ -0,0 +1,17 @@ +pub mod sqlite; + +use crate::minecraft; +use async_trait::async_trait; + +#[async_trait] +pub trait Database { + async fn new() -> Result + where + Self: Sized; + async fn add_server(server: minecraft::server::Server) -> Result<(), String>; + async fn add_player(player: minecraft::player::Player) -> Result<(), String>; + async fn add_targeted_server(server: minecraft::server::Server) -> Result<(), String>; + async fn add_targeted_player(player: minecraft::player::Player) -> Result<(), String>; + + // TODO: Add CLI configuration options +} From e5b63c2aecf9e1d1268d75b70eb720ccdc5655f9 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:21:02 +0800 Subject: [PATCH 007/132] Add SQLite database (for now) --- src/database/sqlite.rs | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/database/sqlite.rs diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs new file mode 100644 index 0000000..734e647 --- /dev/null +++ b/src/database/sqlite.rs @@ -0,0 +1,43 @@ +use crate::minecraft::{player::Player, server::Server}; + +use super::Database; +use async_trait::async_trait; +use sqlx::sqlite::SqlitePoolOptions; + +pub struct SqliteDatabase { + database: sqlx::SqlitePool, +} + +#[async_trait] +impl Database for SqliteDatabase { + async fn new() -> Result { + let database = match SqlitePoolOptions::new() + .connect("sqlite://openheimer.db?mode=rwc") + .await + { + Ok(database) => database, + Err(error) => return Err(error.to_string()), + }; + Ok(SqliteDatabase { database }) + } + + async fn add_server(server: Server) -> Result<(), String> { + // TODO: Add server + Ok(()) + } + + async fn add_player(player: Player) -> Result<(), String> { + // TODO: Add player + Ok(()) + } + + async fn add_targeted_server(server: Server) -> Result<(), String> { + // TODO: Add server + Ok(()) + } + + async fn add_targeted_player(player: Player) -> Result<(), String> { + // TODO: Add player + Ok(()) + } +} From ffa918027f0b174d277b6360f05b4cdf696898ef Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:21:31 +0800 Subject: [PATCH 008/132] Add server/player structs --- src/minecraft/mod.rs | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/minecraft/mod.rs diff --git a/src/minecraft/mod.rs b/src/minecraft/mod.rs new file mode 100644 index 0000000..d068dc9 --- /dev/null +++ b/src/minecraft/mod.rs @@ -0,0 +1,2 @@ +pub mod player; +pub mod server; From 951df31a04290f00942d527e52ccdfd01760976b Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:21:48 +0800 Subject: [PATCH 009/132] Add basic player struct --- src/minecraft/player.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/minecraft/player.rs diff --git a/src/minecraft/player.rs b/src/minecraft/player.rs new file mode 100644 index 0000000..75e0282 --- /dev/null +++ b/src/minecraft/player.rs @@ -0,0 +1,12 @@ +#[derive(Clone, Default)] +pub struct Player { + name: String, + uuid: String, +} + +impl Player { + fn from_json(json: String) -> Result { + // TODO: Parse JSON + Ok(Player::default()) + } +} From c940e959dd9177f7313febc35d830150b5204e97 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 10 Apr 2023 21:22:01 +0800 Subject: [PATCH 010/132] Add server struct --- src/minecraft/server.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/minecraft/server.rs diff --git a/src/minecraft/server.rs b/src/minecraft/server.rs new file mode 100644 index 0000000..33a89b5 --- /dev/null +++ b/src/minecraft/server.rs @@ -0,0 +1,23 @@ +#[derive(Clone, Default)] +pub struct Server { + version_name: String, + protocol_version: i32, + favicon: String, + description: String, + description_json: String, + players_online: i32, + players_max: i32, + players_json: String, + mod_info_type: String, + mod_info_list_json: String, + offline_mode: bool, + whitelisted: bool, + extra_data_json: String, +} + +impl Server { + fn from_json(json: String) -> Result { + // TODO: Parse JSON + Ok(Server::default()) + } +} From fa700f4f84f3c16baa5834754652e6e374bb8533 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 18:27:37 +0800 Subject: [PATCH 011/132] Update Minecraft structs --- src/minecraft/player.rs | 10 ++++------ src/minecraft/server.rs | 18 +++++++++--------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/minecraft/player.rs b/src/minecraft/player.rs index 75e0282..17328b5 100644 --- a/src/minecraft/player.rs +++ b/src/minecraft/player.rs @@ -1,12 +1,10 @@ #[derive(Clone, Default)] pub struct Player { + first_seen: u64, + last_seen: u64, + name: String, uuid: String, } -impl Player { - fn from_json(json: String) -> Result { - // TODO: Parse JSON - Ok(Player::default()) - } -} +impl Player {} diff --git a/src/minecraft/server.rs b/src/minecraft/server.rs index 33a89b5..cf7f027 100644 --- a/src/minecraft/server.rs +++ b/src/minecraft/server.rs @@ -1,5 +1,12 @@ #[derive(Clone, Default)] pub struct Server { + address: String, + offline_mode: bool, + whitelisted: bool, + first_seen: u64, + last_seen: u64, + extra_data_json: String, + version_name: String, protocol_version: i32, favicon: String, @@ -10,14 +17,7 @@ pub struct Server { players_json: String, mod_info_type: String, mod_info_list_json: String, - offline_mode: bool, - whitelisted: bool, - extra_data_json: String, + enforces_secure_chat: bool, } -impl Server { - fn from_json(json: String) -> Result { - // TODO: Parse JSON - Ok(Server::default()) - } -} +impl Server {} From 6ffa216a224f9a973a88ceaea14a4f6c2e10614b Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 18:29:59 +0800 Subject: [PATCH 012/132] Add database locations --- src/database/mod.rs | 2 +- src/database/sqlite.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index fe87b68..85fa3ac 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -5,7 +5,7 @@ use async_trait::async_trait; #[async_trait] pub trait Database { - async fn new() -> Result + async fn new(location: String) -> Result where Self: Sized; async fn add_server(server: minecraft::server::Server) -> Result<(), String>; diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 734e647..02e09c2 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -10,9 +10,9 @@ pub struct SqliteDatabase { #[async_trait] impl Database for SqliteDatabase { - async fn new() -> Result { + async fn new(location: String) -> Result { let database = match SqlitePoolOptions::new() - .connect("sqlite://openheimer.db?mode=rwc") + .connect(format!("sqlite://{location}?mode=rwc").as_str()) .await { Ok(database) => database, From f8fcc1d0bfb301ed191e989ecb30832f93a58b2f Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 18:37:34 +0800 Subject: [PATCH 013/132] Add logger --- src/logger.rs | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 src/logger.rs diff --git a/src/logger.rs b/src/logger.rs new file mode 100644 index 0000000..2056019 --- /dev/null +++ b/src/logger.rs @@ -0,0 +1,59 @@ +use chrono::Local; +use colored::*; + +pub enum LogMessageType { + Information, + Error, + Warning, +} + +pub fn log_error(result: Result) { + match result { + Ok(_) => (), + Err(error) => log_message(LogMessageType::Error, &error.to_string()), + } +} + +pub fn log_message(message_type: LogMessageType, message: &String) { + match message_type { + LogMessageType::Information => { + println!( + "{} {} {}", + current_time(), + colored_brackets(&"INFORMATION".bold().blue()), + message + ) + } + LogMessageType::Warning => { + eprintln!( + "{} {} {}", + current_time(), + colored_brackets(&"WARNING".bold().yellow()), + message + ) + } + LogMessageType::Error => eprintln!( + "{} {} {}", + current_time(), + colored_brackets(&"ERROR".bold().red()), + message.red() + ), + } +} + +fn current_time() -> String { + format!( + "{}{}{}", + "[".bold().white(), + Local::now() + .format("%Y/%m/%d %H:%M:%S") + .to_string() + .bold() + .white(), + "]".bold().white() + ) +} + +fn colored_brackets(text: &ColoredString) -> String { + format!("{}{}{}", "[".bold().blue(), text, "]".bold().blue()) +} From a5513b07e079d4df865c7ed5cb2809c45cddde36 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 18:37:53 +0800 Subject: [PATCH 014/132] Print startup message --- src/main.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 13c1b86..f119708 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,14 @@ +mod configuration; mod database; +mod logger; mod minecraft; +use logger::log_message; +use logger::LogMessageType::*; + fn main() { - println!("hello, openheimer!") + log_message( + Information, + &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), + ) } From 87a479d41fe56bed45c79533573bf086d024bf8d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 19:03:45 +0800 Subject: [PATCH 015/132] Add verbosity levels --- src/logger.rs | 70 ++++++++++++++++++++++++++++++++------------------- 1 file changed, 44 insertions(+), 26 deletions(-) diff --git a/src/logger.rs b/src/logger.rs index 2056019..b7d0b87 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -2,42 +2,60 @@ use chrono::Local; use colored::*; pub enum LogMessageType { + Verbose1 = 1, + Verbose2 = 2, + Verbose3 = 3, Information, Error, Warning, } -pub fn log_error(result: Result) { - match result { - Ok(_) => (), - Err(error) => log_message(LogMessageType::Error, &error.to_string()), - } +pub struct Logger { + pub verbosity: usize, } - -pub fn log_message(message_type: LogMessageType, message: &String) { - match message_type { - LogMessageType::Information => { - println!( - "{} {} {}", - current_time(), - colored_brackets(&"INFORMATION".bold().blue()), - message - ) +impl Logger { + pub fn log_error(&self, result: Result) { + match result { + Ok(_) => (), + Err(error) => self.log_message(LogMessageType::Error, &error.to_string()), } - LogMessageType::Warning => { - eprintln!( + } + + pub fn log_message(&self, message_type: LogMessageType, message: &str) { + match message_type { + LogMessageType::Information => { + println!( + "{} {} {}", + current_time(), + colored_brackets(&"INFORMATION".bold().blue()), + message + ) + } + LogMessageType::Verbose1 | LogMessageType::Verbose2 | LogMessageType::Verbose3 => { + if self.verbosity >= message_type as usize { + println!( + "{} {} {}", + current_time(), + colored_brackets(&"VERBOSE".bold().blue()), + message + ) + } + } + LogMessageType::Warning => { + eprintln!( + "{} {} {}", + current_time(), + colored_brackets(&"WARNING".bold().yellow()), + message + ) + } + LogMessageType::Error => eprintln!( "{} {} {}", current_time(), - colored_brackets(&"WARNING".bold().yellow()), - message - ) + colored_brackets(&"ERROR".bold().red()), + message.red() + ), } - LogMessageType::Error => eprintln!( - "{} {} {}", - current_time(), - colored_brackets(&"ERROR".bold().red()), - message.red() - ), } } From 67d725679ac9e8259b0a94a9a3b14207f14b9940 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 19:03:58 +0800 Subject: [PATCH 016/132] Add basic argument parser --- src/main.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index f119708..f381b20 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,12 +3,26 @@ mod database; mod logger; mod minecraft; -use logger::log_message; +use clap::{Arg, ArgAction, Command}; use logger::LogMessageType::*; fn main() { - log_message( + let matches = Command::new("openheimer") + .about("The final word in Minecraft server scanners") + .arg( + Arg::new("verbosity") + .short('v') + .long("verbose") + .help("Sets the level of verbosity") + .action(ArgAction::Count), + ) + .get_matches(); + + let logger = logger::Logger { + verbosity: matches.get_count("verbosity") as usize, + }; + logger.log_message( Information, &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), - ) + ); } From dbfbcf2edc82a57be4cd06e91c5561b61a5124e6 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 19:11:02 +0800 Subject: [PATCH 017/132] Bump version --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index fd0faf4..0118669 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "openheimer" -version = "0.1.0" +version = "2.0.0-alpha" edition = "2021" [dependencies] From b6fed3a613c182d232e30f78ab2ac32e66a00a73 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 22:14:39 +0800 Subject: [PATCH 018/132] Add basic configuration structs --- src/configuration.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/configuration.rs diff --git a/src/configuration.rs b/src/configuration.rs new file mode 100644 index 0000000..844537a --- /dev/null +++ b/src/configuration.rs @@ -0,0 +1,31 @@ +use std::str::FromStr; + +#[derive(Clone)] +pub struct DatabaseConfiguration { + provider: String, + location: String, +} + +#[derive(Clone)] +pub struct Configuration { + database: DatabaseConfiguration, +} + +impl Default for Configuration { + fn default() -> Self { + Configuration { + database: DatabaseConfiguration { + provider: "sqlite".to_string(), + location: "openheimer.db".to_string(), + }, + } + } +} + +impl FromStr for Configuration { + type Err = String; + + fn from_str(string: &str) -> Result { + Ok(Default::default()) + } +} From d1e52703c150227ca9960ef4187ffa8339b22a9f Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 22:14:58 +0800 Subject: [PATCH 019/132] Add required dependencies --- Cargo.lock | 374 +++++++++++++++++++++++++++++++++++++++++++++++++++-- Cargo.toml | 5 +- 2 files changed, 367 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ae2660d..f94c415 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,6 +13,15 @@ dependencies = [ "version_check", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anstream" version = "0.2.6" @@ -73,6 +82,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -130,6 +150,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "chrono" +version = "0.4.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +dependencies = [ + "iana-time-zone", + "js-sys", + "num-integer", + "num-traits", + "time", + "wasm-bindgen", + "winapi", +] + [[package]] name = "clap" version = "4.2.1" @@ -137,6 +172,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" dependencies = [ "clap_builder", + "clap_derive", + "once_cell", ] [[package]] @@ -152,12 +189,45 @@ dependencies = [ "strsim", ] +[[package]] +name = "clap_derive" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.13", +] + [[package]] name = "clap_lex" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + +[[package]] +name = "colored" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +dependencies = [ + "atty", + "lazy_static", + "winapi", +] + [[package]] name = "concolor-override" version = "1.0.0" @@ -173,6 +243,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "core-foundation-sys" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" + [[package]] name = "cpufeatures" version = "0.2.6" @@ -226,6 +302,50 @@ dependencies = [ "typenum", ] +[[package]] +name = "cxx" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn 2.0.13", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.94" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] + [[package]] name = "digest" version = "0.10.6" @@ -378,7 +498,7 @@ checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", ] [[package]] @@ -408,6 +528,15 @@ dependencies = [ "unicode-segmentation", ] +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.2.6" @@ -429,6 +558,30 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "iana-time-zone" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "idna" version = "0.3.0" @@ -505,6 +658,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + [[package]] name = "libc" version = "0.2.140" @@ -522,6 +681,15 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "link-cplusplus" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" +dependencies = [ + "cc", +] + [[package]] name = "linux-raw-sys" version = "0.3.1" @@ -567,7 +735,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -581,6 +749,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.15" @@ -608,12 +786,15 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "openheimer" -version = "0.1.0" +version = "2.0.0-alpha" dependencies = [ "async-trait", + "chrono", "clap", + "colored", "sqlx", "tokio", + "toml", ] [[package]] @@ -797,6 +978,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" + [[package]] name = "sct" version = "0.7.0" @@ -807,6 +994,21 @@ dependencies = [ "untrusted", ] +[[package]] +name = "serde" +version = "1.0.160" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" + +[[package]] +name = "serde_spanned" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +dependencies = [ + "serde", +] + [[package]] name = "sha2" version = "0.10.6" @@ -1002,6 +1204,15 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "termcolor" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" version = "1.0.40" @@ -1022,6 +1233,17 @@ dependencies = [ "syn 2.0.13", ] +[[package]] +name = "time" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" +dependencies = [ + "libc", + "wasi 0.10.0+wasi-snapshot-preview1", + "winapi", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1089,6 +1311,40 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.19.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "typenum" version = "1.16.0" @@ -1122,6 +1378,12 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + [[package]] name = "unicode_categories" version = "0.1.1" @@ -1163,6 +1425,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "wasi" +version = "0.10.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1268,19 +1536,37 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +dependencies = [ + "windows-targets 0.48.0", +] + [[package]] name = "windows-sys" version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", ] [[package]] @@ -1289,13 +1575,28 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] @@ -1304,38 +1605,89 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + +[[package]] +name = "winnow" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +dependencies = [ + "memchr", +] diff --git a/Cargo.toml b/Cargo.toml index 0118669..e510b61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,10 @@ version = "2.0.0-alpha" edition = "2021" [dependencies] -clap = "4.2" +clap = { version = "4.2", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } async-trait = "0.1.68" +colored = "2.0.0" +chrono = "0.4.24" +toml = "0.7.3" From 4932ee2c09a158802322804c4247eb031724f33d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 3 May 2023 22:15:33 +0800 Subject: [PATCH 020/132] Format code --- src/main.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.rs b/src/main.rs index f381b20..63e8cbf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,6 +21,7 @@ fn main() { let logger = logger::Logger { verbosity: matches.get_count("verbosity") as usize, }; + logger.log_message( Information, &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), From 9b35fe005357ecbdaeaf92154ca394c9ad534c7e Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:27:44 +0800 Subject: [PATCH 021/132] Add serde_derive --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index e510b61..606ca2e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ version = "2.0.0-alpha" edition = "2021" [dependencies] +serde = { version = "1.0", features = ["derive"] } clap = { version = "4.2", features = ["derive"] } tokio = { version = "1.0", features = ["full"] } sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } From 35e674c13dcb7645b37305b647408d84f286749a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:28:39 +0800 Subject: [PATCH 022/132] Add serde_derive --- src/configuration.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index 844537a..a540d97 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,12 +1,13 @@ +use serde::Serialize; use std::str::FromStr; -#[derive(Clone)] +#[derive(Clone, Serialize)] pub struct DatabaseConfiguration { provider: String, location: String, } -#[derive(Clone)] +#[derive(Clone, Serialize)] pub struct Configuration { database: DatabaseConfiguration, } @@ -29,3 +30,9 @@ impl FromStr for Configuration { Ok(Default::default()) } } + +impl ToString for Configuration { + fn to_string(&self) -> String { + toml::to_string_pretty(&self).unwrap() + } +} From 33aca3fd7d5c22682d9bac20219bebd76b101eaa Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:28:45 +0800 Subject: [PATCH 023/132] Rename sqlite to sqlite3 --- src/configuration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuration.rs b/src/configuration.rs index a540d97..e38718d 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -16,7 +16,7 @@ impl Default for Configuration { fn default() -> Self { Configuration { database: DatabaseConfiguration { - provider: "sqlite".to_string(), + provider: "sqlite3".to_string(), location: "openheimer.db".to_string(), }, } From 90fdb6de632d58c141fcfe26dcb624b7c024b0c2 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:29:02 +0800 Subject: [PATCH 024/132] Read and parse configuration --- src/main.rs | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/main.rs b/src/main.rs index 63e8cbf..8cbbd63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,9 @@ mod logger; mod minecraft; use clap::{Arg, ArgAction, Command}; +use configuration::Configuration; use logger::LogMessageType::*; +use std::str::FromStr; fn main() { let matches = Command::new("openheimer") @@ -26,4 +28,33 @@ fn main() { Information, &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), ); + + let mut configuration_string; + if std::path::Path::new("openheimer.toml").exists() { + logger.log_message(Verbose1, "Reading configuration from openheimer.toml..."); + configuration_string = match std::fs::read_to_string("openheimer.toml") { + Ok(file_data) => file_data, + Err(error) => { + logger.log_error("Unable to read openheimer.toml", &error); + return; + } + }; + } else { + logger.log_message( + Verbose1, + "Saving default configuration to openheimer.toml...", + ); + let defualt_configuration_string = Configuration::default().to_string(); + configuration_string = defualt_configuration_string.clone(); + match std::fs::write("openheimer.toml", &defualt_configuration_string) { + Ok(_) => (), + Err(error) => { + logger.log_error("Unable to write to openheimer.toml", &error); + return; + } + }; + } + + logger.log_message(Verbose3, "Parsing configuration from string..."); + let configuration = Configuration::from_str(&configuration_string); } From 49a8a32793d9a154b97f7964dd67f2377a7876d1 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:29:21 +0800 Subject: [PATCH 025/132] Improve log_error --- src/logger.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/logger.rs b/src/logger.rs index b7d0b87..e133d6c 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -14,11 +14,11 @@ pub struct Logger { pub verbosity: usize, } impl Logger { - pub fn log_error(&self, result: Result) { - match result { - Ok(_) => (), - Err(error) => self.log_message(LogMessageType::Error, &error.to_string()), - } + pub fn log_error(&self, error_description: &str, error: &impl std::fmt::Display) { + self.log_message( + LogMessageType::Error, + &format!("{} ({})", &error_description, &error.to_string()), + ); } pub fn log_message(&self, message_type: LogMessageType, message: &str) { From 4b1169a48d615c6ec35edbab31dc1a8506fc52e4 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:30:07 +0800 Subject: [PATCH 026/132] Ignore configuration file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ea8c4bf..47ef786 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +openheimer.toml From ddc5959517f14be90f9596857e7cc9d264c95a2e Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:30:24 +0800 Subject: [PATCH 027/132] Add serde_derive --- Cargo.lock | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index f94c415..c3db8c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -792,6 +792,7 @@ dependencies = [ "chrono", "clap", "colored", + "serde", "sqlx", "tokio", "toml", @@ -999,6 +1000,20 @@ name = "serde" version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.160" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.13", +] [[package]] name = "serde_spanned" From 6e1e14a8c91eeccdc28fa48ff18921546f2a4028 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 15:47:05 +0800 Subject: [PATCH 028/132] Update dependencies --- Cargo.lock | 522 ++++++++++++++++++++--------------------------------- 1 file changed, 198 insertions(+), 324 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c3db8c4..f266ed0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,6 +13,29 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", +] + +[[package]] +name = "allocator-api2" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -24,39 +47,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.2.6" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", + "anstyle-query", "anstyle-wincon", - "concolor-override", - "concolor-query", + "colorchoice", "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "0.3.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" [[package]] name = "anstyle-parse" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys", +] + [[package]] name = "anstyle-wincon" -version = "0.2.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", "windows-sys", @@ -70,7 +102,7 @@ checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -101,9 +133,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bitflags" @@ -122,9 +154,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -152,13 +184,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ + "android-tzdata", "iana-time-zone", "js-sys", - "num-integer", "num-traits", "time", "wasm-bindgen", @@ -167,9 +199,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.2.1" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046ae530c528f252094e4a77886ee1374437744b2bff1497aa898bbddbbb29b3" +checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" dependencies = [ "clap_builder", "clap_derive", @@ -178,9 +210,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.2.1" +version = "4.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "223163f58c9a40c3b0a43e1c4b50a9ce09f007ea2cb1ec258a687945b4b7929f" +checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" dependencies = [ "anstream", "anstyle", @@ -191,31 +223,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.2.0" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] name = "clap_lex" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1" +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] -name = "codespan-reporting" -version = "0.11.1" +name = "colorchoice" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" @@ -228,21 +256,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "concolor-override" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" - -[[package]] -name = "concolor-query" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" -dependencies = [ - "windows-sys", -] - [[package]] name = "core-foundation-sys" version = "0.8.4" @@ -251,9 +264,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -285,9 +298,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if", ] @@ -302,55 +315,11 @@ dependencies = [ "typenum", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.13", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.13", -] - [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -370,9 +339,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", @@ -409,9 +378,9 @@ dependencies = [ [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -492,9 +461,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -506,17 +475,24 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" dependencies = [ - "ahash", + "ahash 0.8.3", + "allocator-api2", ] [[package]] name = "hashlink" -version = "0.8.1" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69fe1fcf8b4278d860ad0548329f892a3631fb63f82574df68275f34cdbe0ffa" +checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" dependencies = [ - "hashbrown", + "hashbrown 0.14.0", ] [[package]] @@ -560,9 +536,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "iana-time-zone" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" +checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -574,19 +550,18 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -599,7 +574,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -613,9 +588,9 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", @@ -624,9 +599,9 @@ dependencies = [ [[package]] name = "is-terminal" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", @@ -651,9 +626,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -666,9 +641,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "libsqlite3-sys" @@ -681,26 +656,17 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" -version = "0.3.1" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" dependencies = [ "autocfg", "scopeguard", @@ -708,12 +674,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -729,12 +692,11 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", ] @@ -749,16 +711,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -780,9 +732,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "openheimer" @@ -816,7 +768,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.7", + "parking_lot_core 0.9.8", ] [[package]] @@ -828,22 +780,22 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] [[package]] name = "parking_lot_core" -version = "0.9.7" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "smallvec", - "windows-sys", + "windows-targets", ] [[package]] @@ -854,28 +806,28 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", ] [[package]] @@ -892,24 +844,24 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.26" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" dependencies = [ "proc-macro2", ] @@ -923,6 +875,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "ring" version = "0.16.20" @@ -940,9 +901,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.6" +version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ "bitflags", "errno", @@ -979,12 +940,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "sct" version = "0.7.0" @@ -997,38 +952,38 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" dependencies = [ "serde", ] [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -1111,7 +1066,7 @@ version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" dependencies = [ - "ahash", + "ahash 0.7.6", "atoi", "bitflags", "byteorder", @@ -1210,24 +1165,15 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.40" @@ -1245,7 +1191,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -1276,9 +1222,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -1295,13 +1241,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.18", ] [[package]] @@ -1317,9 +1263,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb52b74f05dbf495a8fba459fdc331812b96aa086d9eb78101fa0d4569c3313" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" dependencies = [ "futures-core", "pin-project-lite", @@ -1328,9 +1274,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" dependencies = [ "serde", "serde_spanned", @@ -1340,18 +1286,18 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" dependencies = [ "indexmap", "serde", @@ -1374,9 +1320,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -1393,12 +1339,6 @@ version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "unicode_categories" version = "0.1.1" @@ -1413,9 +1353,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -1454,9 +1394,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1464,24 +1404,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1489,28 +1429,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.18", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -1551,15 +1491,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -1572,31 +1503,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets", ] [[package]] name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -1605,93 +1521,51 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" @@ -1700,9 +1574,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] From 57bb1eadb8b95b7459a9af1114a37d19c4657d39 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 18:07:08 +0800 Subject: [PATCH 029/132] Add ConfigurationWarning --- src/logger.rs | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/src/logger.rs b/src/logger.rs index e133d6c..a94accf 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -6,13 +6,15 @@ pub enum LogMessageType { Verbose2 = 2, Verbose3 = 3, Information, - Error, Warning, + ConfigurationWarning, + Error, } pub struct Logger { pub verbosity: usize, } + impl Logger { pub fn log_error(&self, error_description: &str, error: &impl std::fmt::Display) { self.log_message( @@ -23,14 +25,6 @@ impl Logger { pub fn log_message(&self, message_type: LogMessageType, message: &str) { match message_type { - LogMessageType::Information => { - println!( - "{} {} {}", - current_time(), - colored_brackets(&"INFORMATION".bold().blue()), - message - ) - } LogMessageType::Verbose1 | LogMessageType::Verbose2 | LogMessageType::Verbose3 => { if self.verbosity >= message_type as usize { println!( @@ -41,6 +35,14 @@ impl Logger { ) } } + LogMessageType::Information => { + println!( + "{} {} {}", + current_time(), + colored_brackets(&"INFORMATION".bold().blue()), + message + ) + } LogMessageType::Warning => { eprintln!( "{} {} {}", @@ -49,6 +51,15 @@ impl Logger { message ) } + LogMessageType::ConfigurationWarning => { + eprintln!( + "{} {} {} {}", + current_time(), + colored_brackets(&"WARNING".bold().yellow()), + colored_brackets(&"CONFIGURATION".bold().yellow()), + message + ) + } LogMessageType::Error => eprintln!( "{} {} {}", current_time(), From 37cdcce42727fd673a48778916139ad3a6a4b050 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 18:07:30 +0800 Subject: [PATCH 030/132] Parse configuration --- src/configuration.rs | 68 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index e38718d..cdb085d 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,3 +1,5 @@ +use crate::logger; +use logger::LogMessageType::ConfigurationWarning; use serde::Serialize; use std::str::FromStr; @@ -26,8 +28,70 @@ impl Default for Configuration { impl FromStr for Configuration { type Err = String; - fn from_str(string: &str) -> Result { - Ok(Default::default()) + fn from_str(string: &str) -> Result { + let logger = logger::Logger { verbosity: 0 }; + + let configuration = string.parse::().unwrap(); + let default_configuration = toml::Table::try_from(Configuration::default()).unwrap(); + + let get_default_value = |tree: &[&str]| { + let mut default_branch = default_configuration.get(tree[0]).unwrap(); + for branch_index in 1..tree.len() { + default_branch = default_branch.get(tree[branch_index]).unwrap(); + } + default_branch.clone() + }; + + let get_value = |tree: &[&str]| { + let mut default_branch = default_configuration.get(tree[0]).unwrap(); + let mut branch = match configuration.get(tree[0]) { + Some(branch) => branch, + None => { + logger.log_message( + ConfigurationWarning, + &format!("Unable to find `{}`, using default!", tree[0]), + ); + default_branch + } + }; + + for branch_index in 1..tree.len() { + default_branch = default_branch.get(tree[branch_index]).unwrap(); + branch = match branch.get(tree[branch_index]) { + Some(branch) => branch, + None => { + logger.log_message( + ConfigurationWarning, + &format!( + "Unable to find `{}`, using default!", + tree.split_at(branch_index + 1).0.join(".") + ), + ); + default_branch + } + }; + } + + branch.clone() + }; + + let get_string_value = |tree: &[&str]| match get_value(tree).as_str() { + Some(value) => value.to_string(), + None => { + logger.log_message( + ConfigurationWarning, + &format!("`{}` is not a string, using default!", tree.join(".")), + ); + get_default_value(tree).as_str().unwrap().to_string() + } + }; + + Ok(Self { + database: DatabaseConfiguration { + provider: get_string_value(&["database", "provider"]), + location: get_string_value(&["database", "location"]), + }, + }) } } From 8d3203e58bfa2af4173d921bca8b0dbedfc4238d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 18:08:40 +0800 Subject: [PATCH 031/132] Parse & print configuration --- src/main.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 8cbbd63..9b216ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,7 @@ fn main() { &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), ); - let mut configuration_string; + let configuration_string; if std::path::Path::new("openheimer.toml").exists() { logger.log_message(Verbose1, "Reading configuration from openheimer.toml..."); configuration_string = match std::fs::read_to_string("openheimer.toml") { @@ -56,5 +56,15 @@ fn main() { } logger.log_message(Verbose3, "Parsing configuration from string..."); - let configuration = Configuration::from_str(&configuration_string); + let configuration = match Configuration::from_str(&configuration_string) { + Ok(configuration) => configuration, + Err(error) => { + logger.log_error("Unable to parse configuration", &error); + return; + } + }; + logger.log_message( + Verbose3, + &format!("Loaded configuration:\n{}", configuration.to_string()), + ) } From d1e9509c174a688e3d3f41d69a49b10fb83129b0 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 18:08:48 +0800 Subject: [PATCH 032/132] defualt --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 9b216ed..3750aba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -44,9 +44,9 @@ fn main() { Verbose1, "Saving default configuration to openheimer.toml...", ); - let defualt_configuration_string = Configuration::default().to_string(); - configuration_string = defualt_configuration_string.clone(); - match std::fs::write("openheimer.toml", &defualt_configuration_string) { + let default_configuration_string = Configuration::default().to_string(); + configuration_string = default_configuration_string.clone(); + match std::fs::write("openheimer.toml", &default_configuration_string) { Ok(_) => (), Err(error) => { logger.log_error("Unable to write to openheimer.toml", &error); From 7330234b492172fd8b54b6b8a3ec6c6f5b80bad2 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 20 Jun 2023 18:17:38 +0800 Subject: [PATCH 033/132] Add Discord link --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fcf4128..1a29759 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ -# OpenHeimer +# openheimer +[![Discord](https://img.shields.io/discord/1100991922018979850?color=%235865F2&label=discord&logo=discord&style=for-the-badge)](https://discord.com/invite/55FxeEd6dx) + An open-source remake of the Copenheimer project. Scan the entire internet for exposed Minecraft servers! From 4fdaccf3122fa72c77eee8d9dcc44d532519fd3c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 23 Jul 2023 01:27:04 +0800 Subject: [PATCH 034/132] Update dependencies --- Cargo.lock | 324 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 182 insertions(+), 142 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f266ed0..5a848d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.7.6" @@ -26,9 +41,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56fc6cf8dc8c4158eed8649f9b8b0ea1518eb62b544fe9490d66fa0b349eafe9" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" [[package]] name = "android-tzdata" @@ -62,15 +77,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -96,13 +111,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -114,23 +129,27 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" version = "0.21.2" @@ -143,6 +162,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.10.4" @@ -199,9 +224,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.4" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80672091db20273a15cf9fdd4e47ed43b5091ec9841bf4c6145c9dfbbcae09ed" +checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" dependencies = [ "clap_builder", "clap_derive", @@ -210,27 +235,26 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.4" +version = "4.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1458a1df40e1e2afebb7ab60ce55c1fa8f431146205aa5f4887e0b111c27636" +checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -247,13 +271,13 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" -version = "2.0.0" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" +checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" dependencies = [ - "atty", + "is-terminal", "lazy_static", - "winapi", + "windows-sys", ] [[package]] @@ -264,9 +288,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -333,9 +357,15 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" + +[[package]] +name = "equivalent" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" @@ -470,6 +500,12 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "hashbrown" version = "0.12.3" @@ -506,27 +542,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "hex" @@ -578,33 +596,31 @@ dependencies = [ ] [[package]] -name = "instant" -version = "0.1.12" +name = "indexmap" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" dependencies = [ - "cfg-if", + "equivalent", + "hashbrown 0.14.0", ] [[package]] -name = "io-lifetimes" -version = "1.0.11" +name = "instant" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys", + "cfg-if", ] [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", + "hermit-abi", "rustix", "windows-sys", ] @@ -620,9 +636,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" @@ -641,9 +657,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.146" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libsqlite3-sys" @@ -658,9 +674,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "lock_api" @@ -690,6 +706,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.8.8" @@ -713,23 +738,32 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi", "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -800,9 +834,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "percent-encoding" @@ -812,29 +846,29 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -850,18 +884,18 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "proc-macro2" -version = "1.0.60" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.28" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9ab9c7eadfd8df19006f1cf1a4aed13540ed5cbc047010ece5826e10825488" +checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" dependencies = [ "proc-macro2", ] @@ -872,7 +906,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -881,7 +915,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -899,15 +933,20 @@ dependencies = [ "winapi", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustix" -version = "0.37.20" +version = "0.38.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" +checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" dependencies = [ - "bitflags", + "bitflags 2.3.3", "errno", - "io-lifetimes", "libc", "linux-raw-sys", "windows-sys", @@ -927,18 +966,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -952,29 +991,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.164" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" +checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.164" +version = "1.0.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" +checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] name = "serde_spanned" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93107647184f6027e3b7dcb2e11034cf95ffa1e3a682c67951963ac69c1c007d" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -1010,9 +1049,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "socket2" @@ -1068,7 +1107,7 @@ checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" dependencies = [ "ahash 0.7.6", "atoi", - "bitflags", + "bitflags 1.3.2", "byteorder", "bytes", "crc", @@ -1084,7 +1123,7 @@ dependencies = [ "futures-util", "hashlink", "hex", - "indexmap", + "indexmap 1.9.3", "itoa", "libc", "libsqlite3-sys", @@ -1138,9 +1177,9 @@ dependencies = [ [[package]] name = "stringprep" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1165,9 +1204,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.18" +version = "2.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d41677bcbe24c20c52e7c70b0d8db04134c5d1066bf98662e2871ad200ea3e" +checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" dependencies = [ "proc-macro2", "quote", @@ -1176,22 +1215,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1222,11 +1261,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.2" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -1247,7 +1287,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", ] [[package]] @@ -1274,9 +1314,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6135d499e69981f9ff0ef2167955a5333c35e36f6937d382974566b3d5b94ec" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -1286,20 +1326,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a76a9312f5ba4c2dec6b9161fdf25d87ad8a09256ccea5a556fef03c706a10f" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.10" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380d56e8670370eee6566b0bfd4265f65b3f432e8c6d85623f728d4fa31f739" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -1320,9 +1360,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -1413,7 +1453,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-shared", ] @@ -1435,7 +1475,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.18", + "syn 2.0.27", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1517,9 +1557,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1574,9 +1614,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" dependencies = [ "memchr", ] From f3fd886f9b28acfda9587cae61ae057bec83cfdc Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 11 Oct 2023 23:15:55 +0800 Subject: [PATCH 035/132] =?UTF-8?q?you=20happy=20now=3F=20=F0=9F=A4=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 74ba557b4bd4f57daad548bacb1a8d67529386a8 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 11 Oct 2023 23:23:01 +0800 Subject: [PATCH 036/132] Add warning message --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 1a29759..96d78d8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # openheimer [![Discord](https://img.shields.io/discord/1100991922018979850?color=%235865F2&label=discord&logo=discord&style=for-the-badge)](https://discord.com/invite/55FxeEd6dx) +⚠️ Under construction ⚠️ + An open-source remake of the Copenheimer project. Scan the entire internet for exposed Minecraft servers! From a13aeda49743f192921d9535381d5fe5459326c4 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 11 Oct 2023 23:23:06 +0800 Subject: [PATCH 037/132] Update dependencies --- Cargo.lock | 366 ++++++++++++++++++++++++++--------------------------- 1 file changed, 182 insertions(+), 184 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a848d4..fd90a4c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -62,30 +62,29 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -101,9 +100,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys", @@ -111,13 +110,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.72" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc6dde6e4ed435a4c1ee4e73592f5ba9da2151af10076cc04858746af9352d09" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -137,9 +136,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -152,9 +151,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bitflags" @@ -164,9 +163,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "block-buffer" @@ -179,27 +178,30 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "byteorder" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +dependencies = [ + "libc", +] [[package]] name = "cfg-if" @@ -209,35 +211,33 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", - "time", "wasm-bindgen", - "winapi", + "windows-targets", ] [[package]] name = "clap" -version = "4.3.19" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -247,21 +247,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -369,31 +369,26 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "event-listener" version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "finl_unicode" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" + [[package]] name = "flume" version = "0.10.14" @@ -497,14 +492,14 @@ checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "hashbrown" @@ -514,9 +509,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" dependencies = [ "ahash 0.8.3", "allocator-api2", @@ -524,11 +519,11 @@ dependencies = [ [[package]] name = "hashlink" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "312f66718a2d7789ffef4f4b7b213138ed9f1eb3aa1d0d82fc99f88fb3ffd26f" +checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.0", + "hashbrown 0.14.1", ] [[package]] @@ -542,9 +537,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "hex" @@ -597,12 +592,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", + "hashbrown 0.14.1", ] [[package]] @@ -627,9 +622,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.5" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" dependencies = [ "either", ] @@ -657,9 +652,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libsqlite3-sys" @@ -674,9 +669,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" @@ -690,15 +685,15 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "minimal-lexical" @@ -722,7 +717,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys", ] @@ -738,9 +733,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", ] @@ -757,9 +752,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -846,29 +841,29 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -884,18 +879,18 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.31" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe8a65d69dd0808184ebb5f836ab526bb259db23c657efa38711b1072ee47f0" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -928,11 +923,25 @@ dependencies = [ "libc", "once_cell", "spin 0.5.2", - "untrusted", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" +dependencies = [ + "cc", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys", +] + [[package]] name = "rustc-demangle" version = "0.1.23" @@ -941,11 +950,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.4" +version = "0.38.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a962918ea88d644592894bc6dc55acc6c0956488adcebbfb6e273506b7fd6e5" +checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", "linux-raw-sys", @@ -954,12 +963,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" +version = "0.20.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" dependencies = [ "log", - "ring", + "ring 0.16.20", "sct", "webpki", ] @@ -985,28 +994,28 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ - "ring", - "untrusted", + "ring 0.16.20", + "untrusted 0.7.1", ] [[package]] name = "serde" -version = "1.0.174" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b88756493a5bd5e5395d53baa70b194b05764ab85b59e43e4b8f4e1192fa9b1" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.174" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5c3a298c7f978e53536f95a63bdc4c4a64550582f31a0359a9afda6aede62e" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -1020,9 +1029,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", @@ -1040,27 +1049,27 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "socket2" -version = "0.4.9" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", - "winapi", + "windows-sys", ] [[package]] @@ -1080,9 +1089,9 @@ dependencies = [ [[package]] name = "sqlformat" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c12bc9199d1db8234678b7051747c07f517cdcf019262d1847b94ec8b1aee3e" +checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" dependencies = [ "itertools", "nom", @@ -1177,10 +1186,11 @@ dependencies = [ [[package]] name = "stringprep" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3737bde7edce97102e0e2b15365bf7a20bfdb5f60f4f9e8d7004258a51a8da" +checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" dependencies = [ + "finl_unicode", "unicode-bidi", "unicode-normalization", ] @@ -1204,9 +1214,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.27" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b60f673f44a8255b9c8c657daf66a596d435f2da81a555b06dc644d080ba45e0" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -1215,33 +1225,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", + "syn 2.0.38", ] [[package]] @@ -1261,11 +1260,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -1287,7 +1285,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", ] [[package]] @@ -1314,9 +1312,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", "serde_spanned", @@ -1335,11 +1333,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -1348,9 +1346,9 @@ dependencies = [ [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" @@ -1360,9 +1358,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -1391,11 +1389,17 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -1420,12 +1424,6 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -1453,7 +1451,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -1475,7 +1473,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.27", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1498,12 +1496,12 @@ dependencies = [ [[package]] name = "webpki" -version = "0.22.0" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" dependencies = [ - "ring", - "untrusted", + "ring 0.17.3", + "untrusted 0.9.0", ] [[package]] @@ -1557,9 +1555,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.1" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1572,51 +1570,51 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.0" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81fac9742fd1ad1bd9643b991319f72dd031016d44b77039a26977eb667141e7" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] From e665f03bd89ad1fa47ede8f54f3f68863987ba3f Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Thu, 12 Oct 2023 01:37:31 +0800 Subject: [PATCH 038/132] Add Nix flake --- flake.lock | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 50 +++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..67a4a6f --- /dev/null +++ b/flake.lock @@ -0,0 +1,77 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "mozilla": { + "locked": { + "lastModified": 1695805681, + "narHash": "sha256-1ElPLD8eFfnuIk0G52HGGpRtQZ4QPCjChRlEOfkZ5ro=", + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "rev": "6eabade97bc28d707a8b9d82ad13ef143836736e", + "type": "github" + }, + "original": { + "owner": "mozilla", + "repo": "nixpkgs-mozilla", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1696879762, + "narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "mozilla": "mozilla", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..66ef21a --- /dev/null +++ b/flake.nix @@ -0,0 +1,50 @@ +{ + description = "openheimer flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + mozilla.url = "github:mozilla/nixpkgs-mozilla"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, mozilla, flake-utils }: + (flake-utils.lib.eachDefaultSystem (system: + let + overlays = [ self.inputs.mozilla.overlays.rust ]; + pkgs = import nixpkgs { inherit system overlays; }; + channel = pkgs.rustChannelOf { + date = "2023-10-11"; + channel = "nightly"; + sha256 = "sha256-gq7H6KCWVbf5rp6ceZVomtz/DOxM40i4TeWCIKxNAr8="; + }; + rust = (channel.rust.override { + targets = [ + "x86_64-unknown-linux-gnu" + "x86_64-unknown-linux-musl" + ]; + extensions = [ "rust-src" ]; + }); + in rec + { + devShells.default = pkgs.mkShell { + name = "rust-environment"; + nativeBuildInputs = []; + buildInputs = [ rust ]; + + PKG_CONFIG_ALLOW_CROSS = true; + PKG_CONFIG_ALL_STATIC = true; + LIBZ_SYS_STATIC = 1; + }; + + packages.openheimer = pkgs.rustPlatform.buildRustPackage { + pname = "openheimer"; + version = "2.0.0-alpha"; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; + nativeBuildInputs = [ pkgs.pkg-config ]; + buildInputs = [ pkgs.udev ]; + }; + defaultPackage = packages.openheimer; + } + )); +} From c6a053a7d1f9c43f2a15832713105bee935882d5 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 15 Oct 2023 19:33:09 +0800 Subject: [PATCH 039/132] Remove extra space --- src/database/sqlite.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 02e09c2..7713b42 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -1,6 +1,5 @@ -use crate::minecraft::{player::Player, server::Server}; - use super::Database; +use crate::minecraft::{player::Player, server::Server}; use async_trait::async_trait; use sqlx::sqlite::SqlitePoolOptions; From 3489466f9ef2654c18c408e5a5aecdd9ea7458e3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:08:46 +0800 Subject: [PATCH 040/132] Use serde for configuration deserialization --- src/configuration.rs | 98 +++++++++----------------------------------- src/main.rs | 2 +- 2 files changed, 20 insertions(+), 80 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index cdb085d..4cca9a6 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,97 +1,37 @@ -use crate::logger; -use logger::LogMessageType::ConfigurationWarning; -use serde::Serialize; +use serde::{Deserialize, Serialize}; use std::str::FromStr; +use toml; -#[derive(Clone, Serialize)] +#[derive(Debug, Deserialize, Serialize)] +#[serde(default)] pub struct DatabaseConfiguration { provider: String, location: String, } -#[derive(Clone, Serialize)] -pub struct Configuration { - database: DatabaseConfiguration, -} - -impl Default for Configuration { +impl Default for DatabaseConfiguration { fn default() -> Self { - Configuration { - database: DatabaseConfiguration { - provider: "sqlite3".to_string(), - location: "openheimer.db".to_string(), - }, + Self { + provider: "sqlite3".to_string(), + location: "openheimer.db".to_string(), } } } +#[derive(Debug, Default, Deserialize, Serialize)] +#[serde(default)] +pub struct Configuration { + database: DatabaseConfiguration, +} + impl FromStr for Configuration { type Err = String; - fn from_str(string: &str) -> Result { - let logger = logger::Logger { verbosity: 0 }; - - let configuration = string.parse::().unwrap(); - let default_configuration = toml::Table::try_from(Configuration::default()).unwrap(); - - let get_default_value = |tree: &[&str]| { - let mut default_branch = default_configuration.get(tree[0]).unwrap(); - for branch_index in 1..tree.len() { - default_branch = default_branch.get(tree[branch_index]).unwrap(); - } - default_branch.clone() - }; - - let get_value = |tree: &[&str]| { - let mut default_branch = default_configuration.get(tree[0]).unwrap(); - let mut branch = match configuration.get(tree[0]) { - Some(branch) => branch, - None => { - logger.log_message( - ConfigurationWarning, - &format!("Unable to find `{}`, using default!", tree[0]), - ); - default_branch - } - }; - - for branch_index in 1..tree.len() { - default_branch = default_branch.get(tree[branch_index]).unwrap(); - branch = match branch.get(tree[branch_index]) { - Some(branch) => branch, - None => { - logger.log_message( - ConfigurationWarning, - &format!( - "Unable to find `{}`, using default!", - tree.split_at(branch_index + 1).0.join(".") - ), - ); - default_branch - } - }; - } - - branch.clone() - }; - - let get_string_value = |tree: &[&str]| match get_value(tree).as_str() { - Some(value) => value.to_string(), - None => { - logger.log_message( - ConfigurationWarning, - &format!("`{}` is not a string, using default!", tree.join(".")), - ); - get_default_value(tree).as_str().unwrap().to_string() - } - }; - - Ok(Self { - database: DatabaseConfiguration { - provider: get_string_value(&["database", "provider"]), - location: get_string_value(&["database", "location"]), - }, - }) + fn from_str(string: &str) -> Result { + match toml::from_str(string) { + Ok(configuration) => Ok(configuration), + Err(error) => Err(format!("deserialization error: {error:?}")), + } } } diff --git a/src/main.rs b/src/main.rs index 3750aba..d874db1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,6 @@ fn main() { }; logger.log_message( Verbose3, - &format!("Loaded configuration:\n{}", configuration.to_string()), + &format!("Loaded configuration:\n{configuration:?}"), ) } From 1cafb00d4d3a5a4fda8bd03939fbe56a806dff67 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:40:06 +0800 Subject: [PATCH 041/132] Add serde_json --- Cargo.lock | 18 ++++++++++++++++++ Cargo.toml | 1 + 2 files changed, 19 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index fd90a4c..ca8d798 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -774,6 +774,7 @@ dependencies = [ "clap", "colored", "serde", + "serde_json", "sqlx", "tokio", "toml", @@ -982,6 +983,12 @@ dependencies = [ "base64", ] +[[package]] +name = "ryu" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" + [[package]] name = "scopeguard" version = "1.2.0" @@ -1018,6 +1025,17 @@ dependencies = [ "syn 2.0.38", ] +[[package]] +name = "serde_json" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_spanned" version = "0.6.3" diff --git a/Cargo.toml b/Cargo.toml index 606ca2e..8cf935d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,4 @@ async-trait = "0.1.68" colored = "2.0.0" chrono = "0.4.24" toml = "0.7.3" +serde_json = "1.0.107" From 51c332de20af4996a7fed1ae14e70404d050bb80 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:40:38 +0800 Subject: [PATCH 042/132] Add Serialize trait to server & player --- src/minecraft/player.rs | 4 +++- src/minecraft/server.rs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/minecraft/player.rs b/src/minecraft/player.rs index 17328b5..8eb955b 100644 --- a/src/minecraft/player.rs +++ b/src/minecraft/player.rs @@ -1,4 +1,6 @@ -#[derive(Clone, Default)] +use serde::Serialize; + +#[derive(Clone, Default, Serialize)] pub struct Player { first_seen: u64, last_seen: u64, diff --git a/src/minecraft/server.rs b/src/minecraft/server.rs index cf7f027..763c070 100644 --- a/src/minecraft/server.rs +++ b/src/minecraft/server.rs @@ -1,4 +1,6 @@ -#[derive(Clone, Default)] +use serde::Serialize; + +#[derive(Clone, Default, Serialize)] pub struct Server { address: String, offline_mode: bool, From 6f348b7df972a4c3e549360d49ac0dd9be7512e3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:41:01 +0800 Subject: [PATCH 043/132] Fix Database trait --- src/database/mod.rs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index 85fa3ac..8d5b832 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -3,15 +3,29 @@ pub mod sqlite; use crate::minecraft; use async_trait::async_trait; +pub enum DatabaseError { + SqlxPoolCreateFailed(sqlx::Error), + SqlxAcquirePoolFailed(sqlx::Error), + SqlxInsertQueryFailed(sqlx::Error), +} + #[async_trait] pub trait Database { - async fn new(location: String) -> Result + async fn new(location: String) -> Result where Self: Sized; - async fn add_server(server: minecraft::server::Server) -> Result<(), String>; - async fn add_player(player: minecraft::player::Player) -> Result<(), String>; - async fn add_targeted_server(server: minecraft::server::Server) -> Result<(), String>; - async fn add_targeted_player(player: minecraft::player::Player) -> Result<(), String>; + async fn add_server(&mut self, server: &minecraft::server::Server) + -> Result<(), DatabaseError>; + async fn add_player(&mut self, player: &minecraft::player::Player) + -> Result<(), DatabaseError>; + async fn add_targeted_server( + &mut self, + server: &minecraft::server::Server, + ) -> Result<(), DatabaseError>; + async fn add_targeted_player( + &mut self, + player: &minecraft::player::Player, + ) -> Result<(), DatabaseError>; // TODO: Add CLI configuration options } From ca44bd6668b13240cb8948eb2185f8a54c1997f9 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:41:19 +0800 Subject: [PATCH 044/132] Add basic trait functions for sqlite3 database --- src/database/sqlite.rs | 82 ++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 19 deletions(-) diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 7713b42..ea13e4b 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -1,42 +1,86 @@ -use super::Database; +use super::{Database, DatabaseError}; use crate::minecraft::{player::Player, server::Server}; use async_trait::async_trait; use sqlx::sqlite::SqlitePoolOptions; pub struct SqliteDatabase { - database: sqlx::SqlitePool, + pool: sqlx::SqlitePool, } #[async_trait] impl Database for SqliteDatabase { - async fn new(location: String) -> Result { - let database = match SqlitePoolOptions::new() + async fn new(location: String) -> Result { + let pool = match SqlitePoolOptions::new() .connect(format!("sqlite://{location}?mode=rwc").as_str()) .await { - Ok(database) => database, - Err(error) => return Err(error.to_string()), + Ok(pool) => pool, + Err(error) => return Err(DatabaseError::SqlxPoolCreateFailed(error)), }; - Ok(SqliteDatabase { database }) + Ok(SqliteDatabase { pool }) } - async fn add_server(server: Server) -> Result<(), String> { - // TODO: Add server - Ok(()) + async fn add_server(&mut self, server: &Server) -> Result<(), DatabaseError> { + let serialized_server = serde_json::to_string(server).unwrap(); + let mut connection = match self.pool.acquire().await { + Ok(connection) => connection, + Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + }; + match sqlx::query("INSERT INTO servers ( serialized_server ) VALUES ( ?1 )") + .bind(serialized_server) + .execute(&mut *connection) + .await + { + Ok(_) => Ok(()), + Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + } } - async fn add_player(player: Player) -> Result<(), String> { - // TODO: Add player - Ok(()) + async fn add_player(&mut self, player: &Player) -> Result<(), DatabaseError> { + let serialized_player = serde_json::to_string(player).unwrap(); + let mut connection = match self.pool.acquire().await { + Ok(connection) => connection, + Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + }; + match sqlx::query("INSERT INTO players ( serialized_player ) VALUES ( ?1 )") + .bind(serialized_player) + .execute(&mut *connection) + .await + { + Ok(_) => Ok(()), + Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + } } - async fn add_targeted_server(server: Server) -> Result<(), String> { - // TODO: Add server - Ok(()) + async fn add_targeted_server(&mut self, server: &Server) -> Result<(), DatabaseError> { + let serialized_server = serde_json::to_string(server).unwrap(); + let mut connection = match self.pool.acquire().await { + Ok(connection) => connection, + Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + }; + match sqlx::query("INSERT INTO targeted_servers ( serialized_server ) VALUES ( ?1 )") + .bind(serialized_server) + .execute(&mut *connection) + .await + { + Ok(_) => Ok(()), + Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + } } - async fn add_targeted_player(player: Player) -> Result<(), String> { - // TODO: Add player - Ok(()) + async fn add_targeted_player(&mut self, player: &Player) -> Result<(), DatabaseError> { + let serialized_player = serde_json::to_string(player).unwrap(); + let mut connection = match self.pool.acquire().await { + Ok(connection) => connection, + Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + }; + match sqlx::query("INSERT INTO targeted_players ( serialized_player ) VALUES ( ?1 )") + .bind(serialized_player) + .execute(&mut *connection) + .await + { + Ok(_) => Ok(()), + Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + } } } From 652864f0f64a9ed0a3ab232e8141a645ebc022dd Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:53:30 +0800 Subject: [PATCH 045/132] Use clap_derive for arguments --- src/main.rs | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main.rs b/src/main.rs index d874db1..c90e764 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,25 +3,24 @@ mod database; mod logger; mod minecraft; -use clap::{Arg, ArgAction, Command}; +use clap::{ArgAction, Parser}; use configuration::Configuration; use logger::LogMessageType::*; use std::str::FromStr; -fn main() { - let matches = Command::new("openheimer") - .about("The final word in Minecraft server scanners") - .arg( - Arg::new("verbosity") - .short('v') - .long("verbose") - .help("Sets the level of verbosity") - .action(ArgAction::Count), - ) - .get_matches(); +/// The final word in Minecraft server scanners +#[derive(Parser)] +#[command(author, version, about, long_about = None)] +struct Arguments { + /// Level of verbosity (can be supplied up to 3 times) + #[arg(short, long, action = ArgAction::Count)] + verbosity: u8, +} +fn main() { + let arguments = Arguments::parse(); let logger = logger::Logger { - verbosity: matches.get_count("verbosity") as usize, + verbosity: arguments.verbosity as usize, }; logger.log_message( From 784f21eb06dc2f7d5d3f83c7ae5c0423f28a3584 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 16 Oct 2023 13:53:56 +0800 Subject: [PATCH 046/132] Use `Information` instead of `Verbose1` --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index c90e764..2b5df56 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ fn main() { }; } else { logger.log_message( - Verbose1, + Information, "Saving default configuration to openheimer.toml...", ); let default_configuration_string = Configuration::default().to_string(); From a6663a5e1bb5dc3b226354a85041cd520fa96400 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 17 Dec 2023 15:44:03 +0800 Subject: [PATCH 047/132] chore: ignore binary and logs --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 47ef786..f11397f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ /target +openheimer openheimer.toml +*.log From d0f83673d776d3c6cb8a9fed96b19e3f85fbaeb4 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 17 Dec 2023 15:46:10 +0800 Subject: [PATCH 048/132] perf: cargo build optimizations --- .cargo/config.toml | 2 ++ Cargo.toml | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..ddff440 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +rustflags = ["-C", "target-cpu=native"] diff --git a/Cargo.toml b/Cargo.toml index 8cf935d..961b79d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,10 @@ name = "openheimer" version = "2.0.0-alpha" edition = "2021" +[profile.release] +codegen-units = 1 +lto = "fat" + [dependencies] serde = { version = "1.0", features = ["derive"] } clap = { version = "4.2", features = ["derive"] } From 664cfa6188dd70324ef94c0f0292b784500313c3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:00:49 +0800 Subject: [PATCH 049/132] chore(cargo): trim build dependency paths --- Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 961b79d..f8fb9b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,3 +1,5 @@ +cargo-features = ["trim-paths"] + [package] name = "openheimer" version = "2.0.0-alpha" @@ -6,6 +8,7 @@ edition = "2021" [profile.release] codegen-units = 1 lto = "fat" +trim-paths = "all" [dependencies] serde = { version = "1.0", features = ["derive"] } From ccf3af56aee8dd7aab2041196698ce8673eabe50 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:03:57 +0800 Subject: [PATCH 050/132] chore(nix): fix up flake --- flake.lock | 85 ++++++++++++++++++++++++++++++++++--------- flake.nix | 103 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 128 insertions(+), 60 deletions(-) diff --git a/flake.lock b/flake.lock index 67a4a6f..36b008a 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -18,28 +18,31 @@ "type": "github" } }, - "mozilla": { + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, "locked": { - "lastModified": 1695805681, - "narHash": "sha256-1ElPLD8eFfnuIk0G52HGGpRtQZ4QPCjChRlEOfkZ5ro=", - "owner": "mozilla", - "repo": "nixpkgs-mozilla", - "rev": "6eabade97bc28d707a8b9d82ad13ef143836736e", + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", "type": "github" }, "original": { - "owner": "mozilla", - "repo": "nixpkgs-mozilla", + "owner": "numtide", + "repo": "flake-utils", "type": "github" } }, "nixpkgs": { "locked": { - "lastModified": 1696879762, - "narHash": "sha256-Ud6bH4DMcYHUDKavNMxAhcIpDGgHMyL/yaDEAVSImQY=", + "lastModified": 1703255338, + "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "f99e5f03cc0aa231ab5950a15ed02afec45ed51a", + "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", "type": "github" }, "original": { @@ -49,11 +52,46 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681358109, + "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", - "mozilla": "mozilla", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "rust-overlay": "rust-overlay" + } + }, + "rust-overlay": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1703384182, + "narHash": "sha256-g5K8bFBCIQ3x/j/MFTpkZo4It5SGWPwhBp/lASiy+pA=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "cb6395cb3c2f69ad028914c90bce833e51d339c9", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" } }, "systems": { @@ -70,6 +108,21 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 66ef21a..9ef40eb 100644 --- a/flake.nix +++ b/flake.nix @@ -1,50 +1,65 @@ { - description = "openheimer flake"; + description = "openheimer"; - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - mozilla.url = "github:mozilla/nixpkgs-mozilla"; - flake-utils.url = "github:numtide/flake-utils"; - }; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + rust-overlay.url = "github:oxalica/rust-overlay"; + }; - outputs = { self, nixpkgs, mozilla, flake-utils }: - (flake-utils.lib.eachDefaultSystem (system: - let - overlays = [ self.inputs.mozilla.overlays.rust ]; - pkgs = import nixpkgs { inherit system overlays; }; - channel = pkgs.rustChannelOf { - date = "2023-10-11"; - channel = "nightly"; - sha256 = "sha256-gq7H6KCWVbf5rp6ceZVomtz/DOxM40i4TeWCIKxNAr8="; - }; - rust = (channel.rust.override { - targets = [ - "x86_64-unknown-linux-gnu" - "x86_64-unknown-linux-musl" - ]; - extensions = [ "rust-src" ]; - }); - in rec - { - devShells.default = pkgs.mkShell { - name = "rust-environment"; - nativeBuildInputs = []; - buildInputs = [ rust ]; + outputs = { + self, + nixpkgs, + flake-utils, + rust-overlay, + }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + overlays = [rust-overlay.overlays.default]; + }; + pkgsStatic = pkgs.pkgsStatic; + pkgsCross = pkgs.pkgsCross; + rust = pkgs.rust-bin.nightly.latest.default.override { + targets = [ + "x86_64-unknown-linux-gnu" + "x86_64-unknown-linux-musl" + "i686-unknown-linux-musl" + "x86_64-pc-windows-gnu" + ]; + extensions = [ + "rust-src" + "rust-analyzer-preview" + ]; + }; + in rec { + devShell = pkgs.mkShell { + name = "openheimer"; + buildInputs = with pkgs; [ + clang + libgit2 + mold + pkgsCross.mingwW64.buildPackages.gcc + rust + ]; - PKG_CONFIG_ALLOW_CROSS = true; - PKG_CONFIG_ALL_STATIC = true; - LIBZ_SYS_STATIC = 1; - }; + CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = "-L native=${pkgsCross.mingwW64.windows.mingw_w64_pthreads}/lib"; + LIBZ_SYS_STATIC = 1; + OPENSSL_DIR = pkgsStatic.openssl.dev; + OPENSSL_LIB_DIR = "${pkgsStatic.openssl.out}/lib"; + OPENSSL_STATIC = 1; + PKG_CONFIG_ALLOW_CROSS = true; + PKG_CONFIG_ALL_STATIC = true; + }; - packages.openheimer = pkgs.rustPlatform.buildRustPackage { - pname = "openheimer"; - version = "2.0.0-alpha"; - cargoLock.lockFile = ./Cargo.lock; - src = pkgs.lib.cleanSource ./.; - nativeBuildInputs = [ pkgs.pkg-config ]; - buildInputs = [ pkgs.udev ]; - }; - defaultPackage = packages.openheimer; - } - )); + packages.openheimer = pkgs.rustPlatform.buildRustPackage { + pname = "openheimer"; + version = "2.0.0-alpha"; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; + nativeBuildInputs = [pkgs.pkg-config]; + buildInputs = [pkgs.udev]; + }; + defaultPackage = packages.openheimer; + }); } From b6402af6d131154173cd596f3804c5516e181fd5 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:05:04 +0800 Subject: [PATCH 051/132] chore: add fetch.sh for npcap --- lib/fetch.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/fetch.sh diff --git a/lib/fetch.sh b/lib/fetch.sh new file mode 100644 index 0000000..0e2b547 --- /dev/null +++ b/lib/fetch.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash +set -e + +PREFIX=$(dirname "$0") +curl -Lo "$PREFIX/npcap-sdk.zip" https://npcap.com/dist/npcap-sdk-1.13.zip +unzip -o "$PREFIX/npcap-sdk.zip" "Lib/*" -d "$PREFIX/npcap" +rm "$PREFIX/npcap-sdk.zip" From 6ed9063b608c50201972e4303a66ff269f9a1478 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:06:41 +0800 Subject: [PATCH 052/132] feat(pnet): windows support --- Cargo.toml | 1 + build.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 build.rs diff --git a/Cargo.toml b/Cargo.toml index f8fb9b5..8e0e611 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,7 @@ cargo-features = ["trim-paths"] name = "openheimer" version = "2.0.0-alpha" edition = "2021" +build = "build.rs" [profile.release] codegen-units = 1 diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..22fc76f --- /dev/null +++ b/build.rs @@ -0,0 +1,15 @@ +// const WINPCAP_LIB_X32: &str = "libs/npcap/Lib/"; +// const WINPCAP_LIB_ARM: &str = "libs/npcap/Lib/ARM64/"; +const WINPCAP_LIB_X64: &str = "lib/npcap/Lib/x64/"; + +fn main() { + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-changed=Cargo.lock"); + + built::write_built_file().unwrap(); + + let target = std::env::var("TARGET").unwrap(); + if target.contains("windows") && target.contains("x86_64") { + println!("cargo:rustc-link-search=native={WINPCAP_LIB_X64}"); + } +} From fe01b9bc4af2b88d2b6e3ea668ce510f930f43a1 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:10:39 +0800 Subject: [PATCH 053/132] feat: git commit hash version --- Cargo.lock | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 15 +++++++------ src/main.rs | 7 +++++- src/metadata.rs | 10 +++++++++ 4 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 src/metadata.rs diff --git a/Cargo.lock b/Cargo.lock index ca8d798..88c7904 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -176,6 +176,15 @@ dependencies = [ "generic-array", ] +[[package]] +name = "built" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d17f4d6e4dc36d1a02fbedc2753a096848e7c1b0772f7654eab8e2c927dd53" +dependencies = [ + "git2", +] + [[package]] name = "bumpalo" version = "3.14.0" @@ -200,6 +209,7 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ + "jobserver", "libc", ] @@ -501,6 +511,19 @@ version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +[[package]] +name = "git2" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +dependencies = [ + "bitflags 2.4.0", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -635,6 +658,15 @@ version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +[[package]] +name = "jobserver" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.64" @@ -656,6 +688,18 @@ version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +[[package]] +name = "libgit2-sys" +version = "0.16.1+1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + [[package]] name = "libsqlite3-sys" version = "0.24.2" @@ -667,6 +711,18 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "libz-sys" +version = "1.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "linux-raw-sys" version = "0.4.10" @@ -770,6 +826,7 @@ name = "openheimer" version = "2.0.0-alpha" dependencies = [ "async-trait", + "built", "chrono", "clap", "colored", diff --git a/Cargo.toml b/Cargo.toml index 8e0e611..8deb919 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,18 +6,21 @@ version = "2.0.0-alpha" edition = "2021" build = "build.rs" +[build-dependencies] +built = { version = "0.7.1", features = ["git2"] } + [profile.release] codegen-units = 1 lto = "fat" trim-paths = "all" [dependencies] -serde = { version = "1.0", features = ["derive"] } -clap = { version = "4.2", features = ["derive"] } -tokio = { version = "1.0", features = ["full"] } -sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } async-trait = "0.1.68" -colored = "2.0.0" chrono = "0.4.24" -toml = "0.7.3" +clap = { version = "4.2", features = ["derive", "string"] } +colored = "2.0.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.107" +sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } +tokio = { version = "1.0", features = ["full"] } +toml = "0.7.3" diff --git a/src/main.rs b/src/main.rs index 2b5df56..c75136c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,7 @@ mod configuration; mod database; mod logger; +mod metadata; mod minecraft; use clap::{ArgAction, Parser}; @@ -25,7 +26,11 @@ fn main() { logger.log_message( Information, - &format!("Starting OpenHeimer v{}...", env!("CARGO_PKG_VERSION")), + &format!( + "openheimer v{} ({})...", + metadata::VERSION, + metadata::GIT_HASH, + ), ); let configuration_string; diff --git a/src/metadata.rs b/src/metadata.rs new file mode 100644 index 0000000..b70efd3 --- /dev/null +++ b/src/metadata.rs @@ -0,0 +1,10 @@ +pub mod build_information { + include!(concat!(env!("OUT_DIR"), "/built.rs")); +} + +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const GIT_HASH: &str = if let Some(git_hash) = build_information::GIT_COMMIT_HASH_SHORT { + git_hash +} else { + "unknown" +}; From a461663044f43ab6afd17bfbbe4f64a603425413 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:10:46 +0800 Subject: [PATCH 054/132] chore: add TODO --- TODO.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..3125af8 --- /dev/null +++ b/TODO.md @@ -0,0 +1,2 @@ +- [ ] Rewrite logger using `log` +- [ ] Add a few basic tests From 22e06faa5e5321b0802bb3a6f8247308846f112a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:15:02 +0800 Subject: [PATCH 055/132] chore(cargo): update dependencies --- Cargo.lock | 1166 ++++++++++++++++++++++++++++++++++------------------ Cargo.toml | 16 +- 2 files changed, 780 insertions(+), 402 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88c7904..d5bb637 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,24 +19,15 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.7.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" dependencies = [ "cfg-if", + "getrandom", "once_cell", "version_check", + "zerocopy", ] [[package]] @@ -62,9 +53,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -82,52 +73,62 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", ] [[package]] name = "atoi" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7c57d12312ff59c811c0643f4d80830505833c9ffaebd193d819392b265be8e" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" dependencies = [ "num-traits", ] +[[package]] +name = "atomic-write-file" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edcdbedc2236483ab103a53415653d6b4442ea6141baf1ffa85df29635e88436" +dependencies = [ + "nix", + "rand", +] + [[package]] name = "autocfg" version = "1.1.0" @@ -151,9 +152,15 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bitflags" @@ -163,9 +170,12 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +dependencies = [ + "serde", +] [[package]] name = "block-buffer" @@ -230,14 +240,14 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] name = "clap" -version = "4.4.6" +version = "4.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" dependencies = [ "clap_builder", "clap_derive", @@ -245,9 +255,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstream", "anstyle", @@ -257,21 +267,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -281,26 +291,31 @@ checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "colored" -version = "2.0.4" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" +checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8" dependencies = [ - "is-terminal", "lazy_static", - "windows-sys", + "windows-sys 0.48.0", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -316,15 +331,15 @@ dependencies = [ [[package]] name = "crc-catalog" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cace84e55f07e7301bae1c519df89cdad8cc3cd868413d3fdbdeca9ff3db484" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crossbeam-queue" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +checksum = "adc6598521bb5a83d491e8c1fe51db7296019d2ca3cb93cc6c2a20369a4d78a2" dependencies = [ "cfg-if", "crossbeam-utils", @@ -332,9 +347,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" dependencies = [ "cfg-if", ] @@ -349,6 +364,17 @@ dependencies = [ "typenum", ] +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "digest" version = "0.10.7" @@ -356,7 +382,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", + "subtle", ] [[package]] @@ -370,6 +398,9 @@ name = "either" version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +dependencies = [ + "serde", +] [[package]] name = "equivalent" @@ -379,12 +410,23 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "etcetera" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "136d1b5283a1ab77bd9257427ffd09d8667ced0570b6f938942bc7568ed5b943" +dependencies = [ + "cfg-if", + "home", + "windows-sys 0.48.0", ] [[package]] @@ -393,6 +435,12 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "finl_unicode" version = "1.2.0" @@ -401,30 +449,29 @@ checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" [[package]] name = "flume" -version = "0.10.14" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" dependencies = [ "futures-core", "futures-sink", - "pin-project", "spin 0.9.8", ] [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -432,15 +479,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -449,36 +496,44 @@ dependencies = [ [[package]] name = "futures-intrusive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a604f7a68fbf8103337523b1fadc8ade7361ee3f112f7c680ad179651616aed5" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" dependencies = [ "futures-core", "lock_api", - "parking_lot 0.11.2", + "parking_lot", ] +[[package]] +name = "futures-io" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" + [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", + "futures-io", "futures-sink", "futures-task", + "memchr", "pin-project-lite", "pin-utils", "slab", @@ -496,9 +551,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if", "libc", @@ -507,9 +562,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" @@ -517,7 +572,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "libc", "libgit2-sys", "log", @@ -526,17 +581,11 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" dependencies = [ - "ahash 0.8.3", + "ahash", "allocator-api2", ] @@ -546,7 +595,7 @@ version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e8094feaf31ff591f651a2664fb9cfd92bba7a60ce3197265e9482ebe753c8f7" dependencies = [ - "hashbrown 0.14.1", + "hashbrown", ] [[package]] @@ -571,92 +620,89 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "iana-time-zone" -version = "0.1.57" +name = "hkdf" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fad5b825842d2b38bd206f3e81d6957625fd7f0a361e345c30e01a0ae2dd613" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", + "hmac", ] [[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" +name = "hmac" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "cc", + "digest", ] [[package]] -name = "idna" -version = "0.4.0" +name = "home" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "windows-sys 0.52.0", ] [[package]] -name = "indexmap" -version = "1.9.3" +name = "iana-time-zone" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ - "autocfg", - "hashbrown 0.12.3", + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", ] [[package]] -name = "indexmap" -version = "2.0.2" +name = "iana-time-zone-haiku" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "equivalent", - "hashbrown 0.14.1", + "cc", ] [[package]] -name = "instant" -version = "0.1.12" +name = "idna" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ - "cfg-if", + "unicode-bidi", + "unicode-normalization", ] [[package]] -name = "is-terminal" -version = "0.4.9" +name = "indexmap" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", + "equivalent", + "hashbrown", ] [[package]] name = "itertools" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" @@ -669,9 +715,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -681,12 +727,15 @@ name = "lazy_static" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +dependencies = [ + "spin 0.5.2", +] [[package]] name = "libc" -version = "0.2.149" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libgit2-sys" @@ -700,11 +749,17 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "libsqlite3-sys" -version = "0.24.2" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ "cc", "pkg-config", @@ -725,15 +780,15 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "lock_api" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" +checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" dependencies = [ "autocfg", "scopeguard", @@ -745,11 +800,21 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "minimal-lexical" @@ -768,13 +833,24 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", - "windows-sys", + "windows-sys 0.48.0", +] + +[[package]] +name = "nix" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" +dependencies = [ + "bitflags 2.4.1", + "cfg-if", + "libc", ] [[package]] @@ -787,6 +863,44 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151" +dependencies = [ + "byteorder", + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.17" @@ -794,6 +908,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -808,18 +923,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openheimer" @@ -837,17 +952,6 @@ dependencies = [ "toml", ] -[[package]] -name = "parking_lot" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" -dependencies = [ - "instant", - "lock_api", - "parking_lot_core 0.8.6", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -855,34 +959,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.8", -] - -[[package]] -name = "parking_lot_core" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" -dependencies = [ - "cfg-if", - "instant", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "winapi", + "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.9.8" +version = "0.9.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" +checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -892,30 +982,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "pin-project" -version = "1.1.3" +name = "pem-rfc7468" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ - "pin-project-internal", + "base64ct", ] [[package]] -name = "pin-project-internal" -version = "1.1.3" +name = "percent-encoding" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.38", -] +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project-lite" @@ -929,75 +1008,128 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" + +[[package]] +name = "ppv-lite86" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] [[package]] -name = "redox_syscall" -version = "0.2.16" +name = "rand" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ - "bitflags 1.3.2", + "libc", + "rand_chacha", + "rand_core", ] [[package]] -name = "redox_syscall" -version = "0.3.5" +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ - "bitflags 1.3.2", + "ppv-lite86", + "rand_core", ] [[package]] -name = "ring" -version = "0.16.20" +name = "rand_core" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", + "getrandom", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", ] [[package]] name = "ring" -version = "0.17.3" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babe80d5c16becf6594aa32ad2be8fe08498e7ae60b77de8df700e67f191d7e" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", "libc", "spin 0.9.8", - "untrusted 0.9.0", - "windows-sys", + "untrusted", + "windows-sys 0.48.0", +] + +[[package]] +name = "rsa" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core", + "signature", + "spki", + "subtle", + "zeroize", ] [[package]] @@ -1008,43 +1140,52 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.18" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.20.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b80e3dec595989ea8510028f30c408a4630db12c9cbb8de34203b89d6577e99" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "log", - "ring 0.16.20", + "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64", ] +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "scopeguard" @@ -1054,39 +1195,39 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", + "ring", + "untrusted", ] [[package]] name = "serde" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -1095,13 +1236,24 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.8" @@ -1122,6 +1274,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "slab" version = "0.4.9" @@ -1133,18 +1295,18 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1162,11 +1324,21 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "sqlformat" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b7b278788e7be4d0d29c0f39497a0eef3fba6bbc8e70d8bf7fde46edeaa9e85" +checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" dependencies = [ "itertools", "nom", @@ -1175,23 +1347,25 @@ dependencies = [ [[package]] name = "sqlx" -version = "0.6.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8de3b03a925878ed54a954f621e64bf55a3c1bd29652d0d1a17830405350188" +checksum = "dba03c279da73694ef99763320dea58b51095dfe87d001b1d4b5fe78ba8763cf" dependencies = [ "sqlx-core", "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", ] [[package]] name = "sqlx-core" -version = "0.6.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8241483a83a3f33aa5fff7e7d9def398ff9990b2752b6c6112b83c6d246029" +checksum = "d84b0a3c3739e220d94b3239fd69fb1f74bc36e16643423bd99de3b43c21bfbd" dependencies = [ - "ahash 0.7.6", + "ahash", "atoi", - "bitflags 1.3.2", "byteorder", "bytes", "crc", @@ -1199,18 +1373,14 @@ dependencies = [ "dotenvy", "either", "event-listener", - "flume", "futures-channel", "futures-core", - "futures-executor", "futures-intrusive", + "futures-io", "futures-util", "hashlink", "hex", - "indexmap 1.9.3", - "itoa", - "libc", - "libsqlite3-sys", + "indexmap", "log", "memchr", "once_cell", @@ -1218,45 +1388,160 @@ dependencies = [ "percent-encoding", "rustls", "rustls-pemfile", + "serde", + "serde_json", "sha2", "smallvec", "sqlformat", - "sqlx-rt", - "stringprep", "thiserror", + "tokio", "tokio-stream", + "tracing", "url", "webpki-roots", ] [[package]] name = "sqlx-macros" -version = "0.6.3" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9966e64ae989e7e575b19d7265cb79d7fc3cbbdf179835cb0d716f294c2049c9" +checksum = "89961c00dc4d7dffb7aee214964b065072bff69e36ddb9e2c107541f75e4f2a5" dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 1.0.109", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0bd4519486723648186a08785143599760f7cc81c52334a55d6a83ea1e20841" +dependencies = [ + "atomic-write-file", "dotenvy", "either", "heck", + "hex", "once_cell", "proc-macro2", "quote", + "serde", + "serde_json", "sha2", "sqlx-core", - "sqlx-rt", + "sqlx-mysql", + "sqlx-sqlite", "syn 1.0.109", + "tempfile", + "tokio", "url", ] [[package]] -name = "sqlx-rt" -version = "0.6.3" +name = "sqlx-mysql" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" +dependencies = [ + "atoi", + "base64", + "bitflags 2.4.1", + "byteorder", + "bytes", + "crc", + "digest", + "dotenvy", + "either", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "generic-array", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "once_cell", + "percent-encoding", + "rand", + "rsa", + "serde", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-postgres" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "804d3f245f894e61b1e6263c84b23ca675d96753b5abfd5cc8597d86806e8024" +checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ + "atoi", + "base64", + "bitflags 2.4.1", + "byteorder", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "hex", + "hkdf", + "hmac", + "home", + "itoa", + "log", + "md-5", + "memchr", "once_cell", - "tokio", - "tokio-rustls", + "rand", + "serde", + "serde_json", + "sha1", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "210976b7d948c7ba9fced8ca835b11cbb2d677c59c79de41ac0d397e14547490" +dependencies = [ + "atoi", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "tracing", + "url", + "urlencoding", ] [[package]] @@ -1276,6 +1561,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "subtle" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" + [[package]] name = "syn" version = "1.0.109" @@ -1289,33 +1580,46 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "tempfile" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +dependencies = [ + "cfg-if", + "fastrand", + "redox_syscall", + "rustix", + "windows-sys 0.52.0", +] + [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", ] [[package]] @@ -1335,43 +1639,32 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", - "parking_lot 0.12.1", + "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls", - "tokio", - "webpki", + "syn 2.0.48", ] [[package]] @@ -1387,9 +1680,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.8" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", @@ -1399,26 +1692,58 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.15" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" dependencies = [ - "indexmap 2.0.2", + "indexmap", "serde", "serde_spanned", "toml_datetime", "winnow", ] +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", +] + [[package]] name = "typenum" version = "1.17.0" @@ -1427,9 +1752,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -1458,12 +1783,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -1472,15 +1791,21 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" @@ -1507,9 +1832,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1517,24 +1842,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1542,105 +1867,90 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] -name = "web-sys" -version = "0.3.64" +name = "webpki-roots" +version = "0.25.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" -dependencies = [ - "js-sys", - "wasm-bindgen", -] +checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" [[package]] -name = "webpki" -version = "0.22.4" +name = "whoami" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed63aea5ce73d0ff405984102c42de94fc55a6b75765d621c65262469b3c9b53" -dependencies = [ - "ring 0.17.3", - "untrusted 0.9.0", -] +checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" [[package]] -name = "webpki-roots" -version = "0.22.6" +name = "windows-core" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "webpki", + "windows-targets 0.52.0", ] [[package]] -name = "winapi" -version = "0.3.9" +name = "windows-sys" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "windows-targets 0.48.5", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", ] [[package]] -name = "windows-sys" -version = "0.48.0" +name = "windows-targets" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows-targets", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -1649,47 +1959,115 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winnow" -version = "0.5.16" +version = "0.5.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" +checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" dependencies = [ "memchr", ] + +[[package]] +name = "zerocopy" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.48", +] + +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/Cargo.toml b/Cargo.toml index 8deb919..cd8ad06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,12 +15,12 @@ lto = "fat" trim-paths = "all" [dependencies] -async-trait = "0.1.68" -chrono = "0.4.24" -clap = { version = "4.2", features = ["derive", "string"] } -colored = "2.0.0" +async-trait = "0.1" +chrono = "0.4" +clap = { version = "4.4", features = ["derive", "string"] } +colored = "2.1" serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0.107" -sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls"] } -tokio = { version = "1.0", features = ["full"] } -toml = "0.7.3" +serde_json = "1.0" +sqlx = { version = "0.7", features = ["sqlite", "runtime-tokio-rustls"] } +tokio = { version = "1", features = ["full"] } +toml = "0.8" From fd3aa72c2f67383837c1f3174014964c67dccfa8 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 7 Jan 2024 15:17:55 +0800 Subject: [PATCH 056/132] chore: use mold linker --- .cargo/config.toml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index ddff440..b31de2c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,2 +1,10 @@ [build] rustflags = ["-C", "target-cpu=native"] + +[target.x86_64-unknown-linux-gnu] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=mold"] + +[target.x86_64-unknown-linux-musl] +linker = "clang" +rustflags = ["-C", "link-arg=-fuse-ld=mold"] From 9cf7a7be5145827f293499901fa32d8e4452dbb8 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 8 Jan 2024 00:42:12 +0800 Subject: [PATCH 057/132] chore(TODO): cleanup work --- TODO.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/TODO.md b/TODO.md index 3125af8..d76993f 100644 --- a/TODO.md +++ b/TODO.md @@ -1,2 +1,6 @@ - [ ] Rewrite logger using `log` - [ ] Add a few basic tests +- [ ] (nix) Read version from Cargo.toml +- [ ] Reflect git commit hash in clap +- [ ] Implement proper error enums +- [ ] Add sled as database provider From a11242663abdbcb19c7d1672637dbe23beb0efcc Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 8 Jan 2024 00:44:38 +0800 Subject: [PATCH 058/132] chore: docs/ --- TODO.md => docs/TODO.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TODO.md => docs/TODO.md (100%) diff --git a/TODO.md b/docs/TODO.md similarity index 100% rename from TODO.md rename to docs/TODO.md From 4d4efea3fde9000eb0093e29108b3dd7ba665294 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 8 Jan 2024 00:45:14 +0800 Subject: [PATCH 059/132] refactor: remove todo --- src/database/mod.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index 8d5b832..51c031a 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -26,6 +26,4 @@ pub trait Database { &mut self, player: &minecraft::player::Player, ) -> Result<(), DatabaseError>; - - // TODO: Add CLI configuration options } From 8005aa6174a0f1dbcaf255bfdfa06a58f610e4a0 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 8 Jan 2024 00:45:53 +0800 Subject: [PATCH 060/132] chore(todo): github projects --- docs/TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/TODO.md b/docs/TODO.md index d76993f..ffce5b1 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,3 +1,5 @@ +- [ ] GitHub projects + - [ ] Rewrite logger using `log` - [ ] Add a few basic tests - [ ] (nix) Read version from Cargo.toml From 1eabb6e38177d9ec4815e5bd1909d728d274903c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 15 Jan 2024 15:13:24 +0800 Subject: [PATCH 061/132] refactor: oxidize --- src/configuration.rs | 7 +++---- src/database/mod.rs | 20 +++++++++----------- src/database/sqlite.rs | 36 ++++++++++++++++++------------------ src/logger.rs | 10 +++++----- src/main.rs | 6 +++--- 5 files changed, 38 insertions(+), 41 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index 4cca9a6..ffeb479 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,15 +1,14 @@ use serde::{Deserialize, Serialize}; use std::str::FromStr; -use toml; #[derive(Debug, Deserialize, Serialize)] #[serde(default)] -pub struct DatabaseConfiguration { +pub struct Database { provider: String, location: String, } -impl Default for DatabaseConfiguration { +impl Default for Database { fn default() -> Self { Self { provider: "sqlite3".to_string(), @@ -21,7 +20,7 @@ impl Default for DatabaseConfiguration { #[derive(Debug, Default, Deserialize, Serialize)] #[serde(default)] pub struct Configuration { - database: DatabaseConfiguration, + database: Database, } impl FromStr for Configuration { diff --git a/src/database/mod.rs b/src/database/mod.rs index 51c031a..a732f2b 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -3,27 +3,25 @@ pub mod sqlite; use crate::minecraft; use async_trait::async_trait; -pub enum DatabaseError { - SqlxPoolCreateFailed(sqlx::Error), - SqlxAcquirePoolFailed(sqlx::Error), - SqlxInsertQueryFailed(sqlx::Error), +pub enum Error { + PoolCreate(sqlx::Error), + AcquirePool(sqlx::Error), + InsertQuery(sqlx::Error), } #[async_trait] pub trait Database { - async fn new(location: String) -> Result + async fn new(location: String) -> Result where Self: Sized; - async fn add_server(&mut self, server: &minecraft::server::Server) - -> Result<(), DatabaseError>; - async fn add_player(&mut self, player: &minecraft::player::Player) - -> Result<(), DatabaseError>; + async fn add_server(&mut self, server: &minecraft::server::Server) -> Result<(), Error>; + async fn add_player(&mut self, player: &minecraft::player::Player) -> Result<(), Error>; async fn add_targeted_server( &mut self, server: &minecraft::server::Server, - ) -> Result<(), DatabaseError>; + ) -> Result<(), Error>; async fn add_targeted_player( &mut self, player: &minecraft::player::Player, - ) -> Result<(), DatabaseError>; + ) -> Result<(), Error>; } diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index ea13e4b..7f4729e 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -1,30 +1,30 @@ -use super::{Database, DatabaseError}; +use super::Error; use crate::minecraft::{player::Player, server::Server}; use async_trait::async_trait; use sqlx::sqlite::SqlitePoolOptions; -pub struct SqliteDatabase { +pub struct Database { pool: sqlx::SqlitePool, } #[async_trait] -impl Database for SqliteDatabase { - async fn new(location: String) -> Result { +impl super::Database for Database { + async fn new(location: String) -> Result { let pool = match SqlitePoolOptions::new() .connect(format!("sqlite://{location}?mode=rwc").as_str()) .await { Ok(pool) => pool, - Err(error) => return Err(DatabaseError::SqlxPoolCreateFailed(error)), + Err(error) => return Err(Error::PoolCreate(error)), }; - Ok(SqliteDatabase { pool }) + Ok(Database { pool }) } - async fn add_server(&mut self, server: &Server) -> Result<(), DatabaseError> { + async fn add_server(&mut self, server: &Server) -> Result<(), Error> { let serialized_server = serde_json::to_string(server).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + Err(error) => return Err(Error::AcquirePool(error)), }; match sqlx::query("INSERT INTO servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) @@ -32,15 +32,15 @@ impl Database for SqliteDatabase { .await { Ok(_) => Ok(()), - Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + Err(error) => Err(Error::InsertQuery(error)), } } - async fn add_player(&mut self, player: &Player) -> Result<(), DatabaseError> { + async fn add_player(&mut self, player: &Player) -> Result<(), Error> { let serialized_player = serde_json::to_string(player).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + Err(error) => return Err(Error::AcquirePool(error)), }; match sqlx::query("INSERT INTO players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) @@ -48,15 +48,15 @@ impl Database for SqliteDatabase { .await { Ok(_) => Ok(()), - Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + Err(error) => Err(Error::InsertQuery(error)), } } - async fn add_targeted_server(&mut self, server: &Server) -> Result<(), DatabaseError> { + async fn add_targeted_server(&mut self, server: &Server) -> Result<(), Error> { let serialized_server = serde_json::to_string(server).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + Err(error) => return Err(Error::AcquirePool(error)), }; match sqlx::query("INSERT INTO targeted_servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) @@ -64,15 +64,15 @@ impl Database for SqliteDatabase { .await { Ok(_) => Ok(()), - Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + Err(error) => Err(Error::InsertQuery(error)), } } - async fn add_targeted_player(&mut self, player: &Player) -> Result<(), DatabaseError> { + async fn add_targeted_player(&mut self, player: &Player) -> Result<(), Error> { let serialized_player = serde_json::to_string(player).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(DatabaseError::SqlxAcquirePoolFailed(error)), + Err(error) => return Err(Error::AcquirePool(error)), }; match sqlx::query("INSERT INTO targeted_players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) @@ -80,7 +80,7 @@ impl Database for SqliteDatabase { .await { Ok(_) => Ok(()), - Err(error) => Err(DatabaseError::SqlxInsertQueryFailed(error)), + Err(error) => Err(Error::InsertQuery(error)), } } } diff --git a/src/logger.rs b/src/logger.rs index a94accf..f218dbe 100644 --- a/src/logger.rs +++ b/src/logger.rs @@ -1,5 +1,5 @@ use chrono::Local; -use colored::*; +use colored::{ColoredString, Colorize}; pub enum LogMessageType { Verbose1 = 1, @@ -32,7 +32,7 @@ impl Logger { current_time(), colored_brackets(&"VERBOSE".bold().blue()), message - ) + ); } } LogMessageType::Information => { @@ -41,7 +41,7 @@ impl Logger { current_time(), colored_brackets(&"INFORMATION".bold().blue()), message - ) + ); } LogMessageType::Warning => { eprintln!( @@ -49,7 +49,7 @@ impl Logger { current_time(), colored_brackets(&"WARNING".bold().yellow()), message - ) + ); } LogMessageType::ConfigurationWarning => { eprintln!( @@ -58,7 +58,7 @@ impl Logger { colored_brackets(&"WARNING".bold().yellow()), colored_brackets(&"CONFIGURATION".bold().yellow()), message - ) + ); } LogMessageType::Error => eprintln!( "{} {} {}", diff --git a/src/main.rs b/src/main.rs index c75136c..b74ea43 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,7 +6,7 @@ mod minecraft; use clap::{ArgAction, Parser}; use configuration::Configuration; -use logger::LogMessageType::*; +use logger::LogMessageType::{Information, Verbose1, Verbose3}; use std::str::FromStr; /// The final word in Minecraft server scanners @@ -51,7 +51,7 @@ fn main() { let default_configuration_string = Configuration::default().to_string(); configuration_string = default_configuration_string.clone(); match std::fs::write("openheimer.toml", &default_configuration_string) { - Ok(_) => (), + Ok(()) => (), Err(error) => { logger.log_error("Unable to write to openheimer.toml", &error); return; @@ -70,5 +70,5 @@ fn main() { logger.log_message( Verbose3, &format!("Loaded configuration:\n{configuration:?}"), - ) + ); } From 8d0ae722b8ac6293fac6918b9c33a22bb16010b4 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Wed, 17 Jan 2024 01:06:09 +0800 Subject: [PATCH 062/132] chore(TODO): tracing --- docs/TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/TODO.md b/docs/TODO.md index ffce5b1..0370f08 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,6 +1,6 @@ - [ ] GitHub projects -- [ ] Rewrite logger using `log` +- [ ] Rewrite logging using `tracing` - [ ] Add a few basic tests - [ ] (nix) Read version from Cargo.toml - [ ] Reflect git commit hash in clap From 5131a968f82a8de8cc6e837a755b151ac84b8649 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 28 Jan 2024 18:46:14 +0800 Subject: [PATCH 063/132] chore(cargo): tweak options --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd8ad06..30b7d92 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,11 +7,11 @@ edition = "2021" build = "build.rs" [build-dependencies] -built = { version = "0.7.1", features = ["git2"] } +built = { version = "0.7", features = ["git2"] } [profile.release] codegen-units = 1 -lto = "fat" +lto = true trim-paths = "all" [dependencies] From 498e6c95b65eb5fa7978cd1e67cc9355b6715186 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 28 Jan 2024 18:54:19 +0800 Subject: [PATCH 064/132] chore(nix): flake package fixes --- flake.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 9ef40eb..122026c 100644 --- a/flake.nix +++ b/flake.nix @@ -20,6 +20,7 @@ }; pkgsStatic = pkgs.pkgsStatic; pkgsCross = pkgs.pkgsCross; + rust = pkgs.rust-bin.nightly.latest.default.override { targets = [ "x86_64-unknown-linux-gnu" @@ -48,17 +49,24 @@ OPENSSL_DIR = pkgsStatic.openssl.dev; OPENSSL_LIB_DIR = "${pkgsStatic.openssl.out}/lib"; OPENSSL_STATIC = 1; - PKG_CONFIG_ALLOW_CROSS = true; PKG_CONFIG_ALL_STATIC = true; + PKG_CONFIG_ALLOW_CROSS = true; + RUST_BACKTRACE = 1; }; packages.openheimer = pkgs.rustPlatform.buildRustPackage { pname = "openheimer"; version = "2.0.0-alpha"; + cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; - nativeBuildInputs = [pkgs.pkg-config]; - buildInputs = [pkgs.udev]; + + nativeBuildInputs = with pkgs; [ + clang + libgit2 + mold + rust + ]; }; defaultPackage = packages.openheimer; }); From e1730d61703e298c4e5fe8b97b3166527778ee4e Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 28 Jan 2024 18:56:16 +0800 Subject: [PATCH 065/132] chore(deps): add tracing --- Cargo.lock | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 ++ 2 files changed, 92 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d5bb637..f5f1185 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -863,6 +863,16 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-bigint-dig" version = "0.8.4" @@ -950,8 +960,15 @@ dependencies = [ "sqlx", "tokio", "toml", + "tracing-subscriber", ] +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1265,6 +1282,15 @@ dependencies = [ "digest", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -1622,6 +1648,16 @@ dependencies = [ "syn 2.0.48", ] +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if", + "once_cell", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1742,6 +1778,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", ] [[package]] @@ -1812,6 +1874,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -1896,6 +1964,28 @@ version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.52.0" diff --git a/Cargo.toml b/Cargo.toml index 30b7d92..1716973 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,3 +24,5 @@ serde_json = "1.0" sqlx = { version = "0.7", features = ["sqlite", "runtime-tokio-rustls"] } tokio = { version = "1", features = ["full"] } toml = "0.8" +tracing = "0.1" +tracing-subscriber = "0.3" From 6441f96644199fb38845e249a67e610657a13cbc Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:16:06 +0800 Subject: [PATCH 066/132] chore(deps): add tracing subscriber and appender --- Cargo.lock | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 3 ++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index f5f1185..edfe416 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -335,6 +335,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" +[[package]] +name = "crossbeam-channel" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "crossbeam-queue" version = "0.3.10" @@ -375,6 +384,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + [[package]] name = "digest" version = "0.10.7" @@ -960,6 +978,8 @@ dependencies = [ "sqlx", "tokio", "toml", + "tracing", + "tracing-appender", "tracing-subscriber", ] @@ -1052,6 +1072,12 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1658,6 +1684,35 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +dependencies = [ + "deranged", + "itoa", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +dependencies = [ + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -1760,6 +1815,18 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-appender" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3566e8ce28cc0a3fe42519fc80e6b4c943cc4c8cef275620eb8dac2d3d4e06cf" +dependencies = [ + "crossbeam-channel", + "thiserror", + "time", + "tracing-subscriber", +] + [[package]] name = "tracing-attributes" version = "0.1.27" @@ -1802,6 +1869,7 @@ dependencies = [ "sharded-slab", "smallvec", "thread_local", + "time", "tracing-core", "tracing-log", ] diff --git a/Cargo.toml b/Cargo.toml index 1716973..fbb02d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,4 +25,5 @@ sqlx = { version = "0.7", features = ["sqlite", "runtime-tokio-rustls"] } tokio = { version = "1", features = ["full"] } toml = "0.8" tracing = "0.1" -tracing-subscriber = "0.3" +tracing-appender = "0.2.3" +tracing-subscriber = { version = "0.3", features = ["time", "registry"] } From c0d3b5694feeebae159c9540d3b261f2a0f06b3d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:16:32 +0800 Subject: [PATCH 067/132] feat: new logging system --- src/arguments.rs | 15 ++++++ src/configuration.rs | 35 ++++++++++---- src/logger.rs | 88 ----------------------------------- src/main.rs | 106 ++++++++++++++++++++----------------------- 4 files changed, 90 insertions(+), 154 deletions(-) create mode 100644 src/arguments.rs delete mode 100644 src/logger.rs diff --git a/src/arguments.rs b/src/arguments.rs new file mode 100644 index 0000000..621ff22 --- /dev/null +++ b/src/arguments.rs @@ -0,0 +1,15 @@ +use clap::Parser; +use tracing::level_filters::LevelFilter; + +/// The final word in Minecraft server scanners +#[derive(Debug, Parser)] +#[command(author, version, about, long_about = None)] +pub struct Arguments { + /// How much information to log + #[arg(short, long, default_value = "info")] + pub verbosity: LevelFilter, + + /// openheimer toml configuration file path + #[arg(short, long)] + pub configuration_file: Option, +} diff --git a/src/configuration.rs b/src/configuration.rs index ffeb479..585a6ce 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,7 +1,30 @@ use serde::{Deserialize, Serialize}; use std::str::FromStr; -#[derive(Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize)] +#[serde(default)] +pub struct Configuration { + pub logger: Logger, + pub database: Database, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(default)] +pub struct Logger { + pub directory: String, + pub prefix: String, +} + +impl Default for Logger { + fn default() -> Self { + Self { + directory: "openheimer/logs".into(), + prefix: "openheimer.log".into(), + } + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(default)] pub struct Database { provider: String, @@ -11,18 +34,12 @@ pub struct Database { impl Default for Database { fn default() -> Self { Self { - provider: "sqlite3".to_string(), - location: "openheimer.db".to_string(), + provider: "sqlite3".into(), + location: "openheimer.db".into(), } } } -#[derive(Debug, Default, Deserialize, Serialize)] -#[serde(default)] -pub struct Configuration { - database: Database, -} - impl FromStr for Configuration { type Err = String; diff --git a/src/logger.rs b/src/logger.rs deleted file mode 100644 index f218dbe..0000000 --- a/src/logger.rs +++ /dev/null @@ -1,88 +0,0 @@ -use chrono::Local; -use colored::{ColoredString, Colorize}; - -pub enum LogMessageType { - Verbose1 = 1, - Verbose2 = 2, - Verbose3 = 3, - Information, - Warning, - ConfigurationWarning, - Error, -} - -pub struct Logger { - pub verbosity: usize, -} - -impl Logger { - pub fn log_error(&self, error_description: &str, error: &impl std::fmt::Display) { - self.log_message( - LogMessageType::Error, - &format!("{} ({})", &error_description, &error.to_string()), - ); - } - - pub fn log_message(&self, message_type: LogMessageType, message: &str) { - match message_type { - LogMessageType::Verbose1 | LogMessageType::Verbose2 | LogMessageType::Verbose3 => { - if self.verbosity >= message_type as usize { - println!( - "{} {} {}", - current_time(), - colored_brackets(&"VERBOSE".bold().blue()), - message - ); - } - } - LogMessageType::Information => { - println!( - "{} {} {}", - current_time(), - colored_brackets(&"INFORMATION".bold().blue()), - message - ); - } - LogMessageType::Warning => { - eprintln!( - "{} {} {}", - current_time(), - colored_brackets(&"WARNING".bold().yellow()), - message - ); - } - LogMessageType::ConfigurationWarning => { - eprintln!( - "{} {} {} {}", - current_time(), - colored_brackets(&"WARNING".bold().yellow()), - colored_brackets(&"CONFIGURATION".bold().yellow()), - message - ); - } - LogMessageType::Error => eprintln!( - "{} {} {}", - current_time(), - colored_brackets(&"ERROR".bold().red()), - message.red() - ), - } - } -} - -fn current_time() -> String { - format!( - "{}{}{}", - "[".bold().white(), - Local::now() - .format("%Y/%m/%d %H:%M:%S") - .to_string() - .bold() - .white(), - "]".bold().white() - ) -} - -fn colored_brackets(text: &ColoredString) -> String { - format!("{}{}{}", "[".bold().blue(), text, "]".bold().blue()) -} diff --git a/src/main.rs b/src/main.rs index b74ea43..910008d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,74 +1,66 @@ +mod arguments; mod configuration; mod database; -mod logger; mod metadata; mod minecraft; -use clap::{ArgAction, Parser}; -use configuration::Configuration; -use logger::LogMessageType::{Information, Verbose1, Verbose3}; -use std::str::FromStr; - -/// The final word in Minecraft server scanners -#[derive(Parser)] -#[command(author, version, about, long_about = None)] -struct Arguments { - /// Level of verbosity (can be supplied up to 3 times) - #[arg(short, long, action = ArgAction::Count)] - verbosity: u8, -} +use crate::configuration::Configuration; +use arguments::Arguments; +use clap::Parser; +use std::{process::exit, str::FromStr}; +use tracing::{debug, info, trace, warn}; +use tracing_subscriber::prelude::*; fn main() { let arguments = Arguments::parse(); - let logger = logger::Logger { - verbosity: arguments.verbosity as usize, - }; - - logger.log_message( - Information, - &format!( - "openheimer v{} ({})...", - metadata::VERSION, - metadata::GIT_HASH, - ), - ); - let configuration_string; - if std::path::Path::new("openheimer.toml").exists() { - logger.log_message(Verbose1, "Reading configuration from openheimer.toml..."); - configuration_string = match std::fs::read_to_string("openheimer.toml") { - Ok(file_data) => file_data, + let mut default = false; + let options = if let Some(configuration_file) = arguments.configuration_file { + trace!("reading configuration file..."); + let file_contents = match std::fs::read_to_string(configuration_file) { + Ok(file_contents) => file_contents, Err(error) => { - logger.log_error("Unable to read openheimer.toml", &error); - return; + eprintln!("unable to read configuration file: {error}\n"); + exit(1); } }; - } else { - logger.log_message( - Information, - "Saving default configuration to openheimer.toml...", - ); - let default_configuration_string = Configuration::default().to_string(); - configuration_string = default_configuration_string.clone(); - match std::fs::write("openheimer.toml", &default_configuration_string) { - Ok(()) => (), + trace!("parsing configuration file..."); + match Configuration::from_str(file_contents.as_str()) { + Ok(options) => options, Err(error) => { - logger.log_error("Unable to write to openheimer.toml", &error); - return; + eprintln!("unable to read configuration file: {error}\n"); + exit(1); } - }; - } - - logger.log_message(Verbose3, "Parsing configuration from string..."); - let configuration = match Configuration::from_str(&configuration_string) { - Ok(configuration) => configuration, - Err(error) => { - logger.log_error("Unable to parse configuration", &error); - return; } + } else { + default = true; + Configuration::default() }; - logger.log_message( - Verbose3, - &format!("Loaded configuration:\n{configuration:?}"), - ); + + let binding = options.clone(); + let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( + binding.logger.directory, + binding.logger.prefix, + )); + let file_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true) + .with_writer(file_appender); + let console_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true); + + let subscriber = tracing_subscriber::Registry::default() + .with(file_layer) + .with(console_layer); + match tracing::subscriber::set_global_default(subscriber) { + Ok(()) => (), + Err(error) => eprintln!("unable to set up logging: {error}"), + }; + + info!("openheimer v{} ({})", metadata::VERSION, metadata::GIT_HASH); + if default { + warn!("falling back to default configuration!"); + } + debug!("using configuration: {options:#?}"); } From 6d618f023438acf381014288f7ef5943c1e95363 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:19:38 +0800 Subject: [PATCH 068/132] chore(TODO): finish tracing --- docs/TODO.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/TODO.md b/docs/TODO.md index 0370f08..f7a3685 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,6 +1,6 @@ - [ ] GitHub projects -- [ ] Rewrite logging using `tracing` +- [x] Rewrite logging using `tracing` - [ ] Add a few basic tests - [ ] (nix) Read version from Cargo.toml - [ ] Reflect git commit hash in clap From 6741dcc138293453e7681fb41f0449deebc99c24 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:20:49 +0800 Subject: [PATCH 069/132] tweak(nix): version => "dev" --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 122026c..99fe7c8 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ packages.openheimer = pkgs.rustPlatform.buildRustPackage { pname = "openheimer"; - version = "2.0.0-alpha"; + version = "dev"; cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; From 1c275fa754f7769fc80f738fff98b4c91f353f51 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:23:34 +0800 Subject: [PATCH 070/132] feat: versioning --- docs/TODO.md | 4 ++-- src/arguments.rs | 3 ++- src/main.rs | 2 +- src/metadata.rs | 6 +++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index f7a3685..206d5fd 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -2,7 +2,7 @@ - [x] Rewrite logging using `tracing` - [ ] Add a few basic tests -- [ ] (nix) Read version from Cargo.toml -- [ ] Reflect git commit hash in clap +- [x] (nix) Read version from Cargo.toml +- [x] Reflect git commit hash in clap - [ ] Implement proper error enums - [ ] Add sled as database provider diff --git a/src/arguments.rs b/src/arguments.rs index 621ff22..78cd22c 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -1,9 +1,10 @@ +use crate::metadata; use clap::Parser; use tracing::level_filters::LevelFilter; /// The final word in Minecraft server scanners #[derive(Debug, Parser)] -#[command(author, version, about, long_about = None)] +#[command(author, version = metadata::format(), about, long_about = None)] pub struct Arguments { /// How much information to log #[arg(short, long, default_value = "info")] diff --git a/src/main.rs b/src/main.rs index 910008d..f017afc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,7 +58,7 @@ fn main() { Err(error) => eprintln!("unable to set up logging: {error}"), }; - info!("openheimer v{} ({})", metadata::VERSION, metadata::GIT_HASH); + info!("openheimer {}", metadata::format()); if default { warn!("falling back to default configuration!"); } diff --git a/src/metadata.rs b/src/metadata.rs index b70efd3..679257e 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -6,5 +6,9 @@ pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const GIT_HASH: &str = if let Some(git_hash) = build_information::GIT_COMMIT_HASH_SHORT { git_hash } else { - "unknown" + "unknown commit" }; + +pub fn format() -> String { + format!("v{} ({})", VERSION, GIT_HASH) +} From 50b335a81987ccc5cc366ff54521cd94e1c97c0c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:29:48 +0800 Subject: [PATCH 071/132] refactor: minor cleanups --- build.rs | 2 -- src/arguments.rs | 4 ++-- src/main.rs | 36 +++++++++++++++++++++--------------- src/metadata.rs | 2 +- 4 files changed, 24 insertions(+), 20 deletions(-) diff --git a/build.rs b/build.rs index 22fc76f..48d793e 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,3 @@ -// const WINPCAP_LIB_X32: &str = "libs/npcap/Lib/"; -// const WINPCAP_LIB_ARM: &str = "libs/npcap/Lib/ARM64/"; const WINPCAP_LIB_X64: &str = "lib/npcap/Lib/x64/"; fn main() { diff --git a/src/arguments.rs b/src/arguments.rs index 78cd22c..544d6aa 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -6,11 +6,11 @@ use tracing::level_filters::LevelFilter; #[derive(Debug, Parser)] #[command(author, version = metadata::format(), about, long_about = None)] pub struct Arguments { - /// How much information to log + /// Amount of information to log #[arg(short, long, default_value = "info")] pub verbosity: LevelFilter, - /// openheimer toml configuration file path + /// TOML configuration file path #[arg(short, long)] pub configuration_file: Option, } diff --git a/src/main.rs b/src/main.rs index f017afc..edc4a12 100644 --- a/src/main.rs +++ b/src/main.rs @@ -14,8 +14,19 @@ use tracing_subscriber::prelude::*; fn main() { let arguments = Arguments::parse(); - let mut default = false; - let options = if let Some(configuration_file) = arguments.configuration_file { + let (is_default, options) = get_options(arguments); + + setup_logging(options.clone()); + + info!("openheimer {}", metadata::format()); + if is_default { + warn!("falling back to default configuration!"); + } + debug!("using configuration: {options:#?}"); +} + +fn get_options(arguments: Arguments) -> (bool, Configuration) { + if let Some(configuration_file) = arguments.configuration_file { trace!("reading configuration file..."); let file_contents = match std::fs::read_to_string(configuration_file) { Ok(file_contents) => file_contents, @@ -24,23 +35,24 @@ fn main() { exit(1); } }; + trace!("parsing configuration file..."); match Configuration::from_str(file_contents.as_str()) { - Ok(options) => options, + Ok(options) => (false, options), Err(error) => { eprintln!("unable to read configuration file: {error}\n"); exit(1); } } } else { - default = true; - Configuration::default() - }; + (true, Configuration::default()) + } +} - let binding = options.clone(); +fn setup_logging(options: Configuration) { let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( - binding.logger.directory, - binding.logger.prefix, + options.logger.directory, + options.logger.prefix, )); let file_layer = tracing_subscriber::fmt::layer() .with_file(true) @@ -57,10 +69,4 @@ fn main() { Ok(()) => (), Err(error) => eprintln!("unable to set up logging: {error}"), }; - - info!("openheimer {}", metadata::format()); - if default { - warn!("falling back to default configuration!"); - } - debug!("using configuration: {options:#?}"); } diff --git a/src/metadata.rs b/src/metadata.rs index 679257e..e1c0f34 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -10,5 +10,5 @@ pub const GIT_HASH: &str = if let Some(git_hash) = build_information::GIT_COMMIT }; pub fn format() -> String { - format!("v{} ({})", VERSION, GIT_HASH) + format!("v{VERSION} ({GIT_HASH})") } From 41210d7afe96408767cc866e16d536b045d80c68 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 12:38:57 +0800 Subject: [PATCH 072/132] refactor(database): serialize helper function --- src/database/mod.rs | 11 ++++++++--- src/database/sqlite.rs | 37 ++++++++++++++++++++++++------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/src/database/mod.rs b/src/database/mod.rs index a732f2b..6e32aac 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -4,9 +4,10 @@ use crate::minecraft; use async_trait::async_trait; pub enum Error { - PoolCreate(sqlx::Error), - AcquirePool(sqlx::Error), - InsertQuery(sqlx::Error), + Create(sqlx::Error), + Acquire(sqlx::Error), + Insert(sqlx::Error), + Serialize(serde_json::Error), } #[async_trait] @@ -14,12 +15,16 @@ pub trait Database { async fn new(location: String) -> Result where Self: Sized; + async fn add_server(&mut self, server: &minecraft::server::Server) -> Result<(), Error>; + async fn add_player(&mut self, player: &minecraft::player::Player) -> Result<(), Error>; + async fn add_targeted_server( &mut self, server: &minecraft::server::Server, ) -> Result<(), Error>; + async fn add_targeted_player( &mut self, player: &minecraft::player::Player, diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 7f4729e..8f714f1 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -15,72 +15,83 @@ impl super::Database for Database { .await { Ok(pool) => pool, - Err(error) => return Err(Error::PoolCreate(error)), + Err(error) => return Err(Error::Create(error)), }; Ok(Database { pool }) } async fn add_server(&mut self, server: &Server) -> Result<(), Error> { - let serialized_server = serde_json::to_string(server).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(Error::AcquirePool(error)), + Err(error) => return Err(Error::Acquire(error)), }; + + let serialized_server = serialize(server)?; match sqlx::query("INSERT INTO servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) .execute(&mut *connection) .await { Ok(_) => Ok(()), - Err(error) => Err(Error::InsertQuery(error)), + Err(error) => Err(Error::Insert(error)), } } async fn add_player(&mut self, player: &Player) -> Result<(), Error> { - let serialized_player = serde_json::to_string(player).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(Error::AcquirePool(error)), + Err(error) => return Err(Error::Acquire(error)), }; + + let serialized_player = serialize(player)?; match sqlx::query("INSERT INTO players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) .execute(&mut *connection) .await { Ok(_) => Ok(()), - Err(error) => Err(Error::InsertQuery(error)), + Err(error) => Err(Error::Insert(error)), } } async fn add_targeted_server(&mut self, server: &Server) -> Result<(), Error> { - let serialized_server = serde_json::to_string(server).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(Error::AcquirePool(error)), + Err(error) => return Err(Error::Acquire(error)), }; + + let serialized_server = serialize(server)?; match sqlx::query("INSERT INTO targeted_servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) .execute(&mut *connection) .await { Ok(_) => Ok(()), - Err(error) => Err(Error::InsertQuery(error)), + Err(error) => Err(Error::Insert(error)), } } async fn add_targeted_player(&mut self, player: &Player) -> Result<(), Error> { - let serialized_player = serde_json::to_string(player).unwrap(); let mut connection = match self.pool.acquire().await { Ok(connection) => connection, - Err(error) => return Err(Error::AcquirePool(error)), + Err(error) => return Err(Error::Acquire(error)), }; + + let serialized_player = serialize(player)?; match sqlx::query("INSERT INTO targeted_players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) .execute(&mut *connection) .await { Ok(_) => Ok(()), - Err(error) => Err(Error::InsertQuery(error)), + Err(error) => Err(Error::Insert(error)), } } } + +fn serialize(object: T) -> Result { + match serde_json::to_string(&object) { + Ok(serialized) => Ok(serialized), + Err(error) => Err(super::Error::Serialize(error)), + } +} From 4171a19347bebcd55355ce4a45f95fafee6a8eac Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:00:01 +0800 Subject: [PATCH 073/132] feat: configuration subcommand --- src/arguments.rs | 21 ++++++++++++++++- src/arguments/configuration.rs | 41 ++++++++++++++++++++++++++++++++++ src/main.rs | 12 +++++++++- 3 files changed, 72 insertions(+), 2 deletions(-) create mode 100644 src/arguments/configuration.rs diff --git a/src/arguments.rs b/src/arguments.rs index 544d6aa..5959791 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -1,5 +1,7 @@ +pub mod configuration; + use crate::metadata; -use clap::Parser; +use clap::{Parser, Subcommand}; use tracing::level_filters::LevelFilter; /// The final word in Minecraft server scanners @@ -13,4 +15,21 @@ pub struct Arguments { /// TOML configuration file path #[arg(short, long)] pub configuration_file: Option, + + #[command(subcommand)] + pub subcommand: Option, +} + +#[derive(Debug, Subcommand)] +pub enum MainSubcommand { + Configuration { + #[command(subcommand)] + subcommand: ConfigurationSubcommand, + }, +} + +#[derive(Debug, Subcommand)] +pub enum ConfigurationSubcommand { + Default, + Fill, } diff --git a/src/arguments/configuration.rs b/src/arguments/configuration.rs new file mode 100644 index 0000000..f04412e --- /dev/null +++ b/src/arguments/configuration.rs @@ -0,0 +1,41 @@ +use super::{Arguments, ConfigurationSubcommand}; +use crate::configuration::Configuration; +use std::str::FromStr; + +pub fn parse(arguments: &Arguments, subcommand: &ConfigurationSubcommand) -> bool { + match subcommand { + ConfigurationSubcommand::Default => default(), + ConfigurationSubcommand::Fill => fill(arguments), + } +} + +fn default() -> bool { + println!("{}", Configuration::default().to_string()); + true +} + +fn fill(arguments: &Arguments) -> bool { + let default = Configuration::default(); + let options = if let Some(configuration_file) = &arguments.configuration_file { + let file_contents = match std::fs::read_to_string(configuration_file) { + Ok(file_contents) => file_contents, + Err(error) => { + eprintln!("unable to read configuration file: {error}"); + default.to_string() + } + }; + + match Configuration::from_str(file_contents.as_str()) { + Ok(options) => options, + Err(error) => { + eprintln!("unable to parse configuration file: {error}"); + default + } + } + } else { + default + }; + + println!("{}", options.to_string()); + true +} diff --git a/src/main.rs b/src/main.rs index edc4a12..7997edb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ mod database; mod metadata; mod minecraft; -use crate::configuration::Configuration; +use crate::{arguments::MainSubcommand, configuration::Configuration}; use arguments::Arguments; use clap::Parser; use std::{process::exit, str::FromStr}; @@ -13,6 +13,16 @@ use tracing_subscriber::prelude::*; fn main() { let arguments = Arguments::parse(); + if let Some(ref subcommand) = arguments.subcommand { + let quit = match subcommand { + MainSubcommand::Configuration { subcommand } => { + arguments::configuration::parse(&arguments, subcommand) + } + }; + if quit { + return; + } + } let (is_default, options) = get_options(arguments); From 1f8a3e637f684cd3c70a89c5b1e2b136cd081e9a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:01:29 +0800 Subject: [PATCH 074/132] refactor: add help text --- src/arguments.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/arguments.rs b/src/arguments.rs index 5959791..17e8511 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -22,6 +22,7 @@ pub struct Arguments { #[derive(Debug, Subcommand)] pub enum MainSubcommand { + /// Manipulate openheimer configuration files Configuration { #[command(subcommand)] subcommand: ConfigurationSubcommand, @@ -30,6 +31,9 @@ pub enum MainSubcommand { #[derive(Debug, Subcommand)] pub enum ConfigurationSubcommand { + /// Generate a default configuration file Default, + + /// Add missing options to your existing configuration file Fill, } From e500d1c7b93bcc62effac26a47a67c7ae6f3fabd Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:16:30 +0800 Subject: [PATCH 075/132] feat: `start` subcommand --- src/arguments.rs | 4 ++- src/core.rs | 64 +++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 68 +++--------------------------------------------- 3 files changed, 71 insertions(+), 65 deletions(-) create mode 100644 src/core.rs diff --git a/src/arguments.rs b/src/arguments.rs index 17e8511..942e697 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -6,7 +6,7 @@ use tracing::level_filters::LevelFilter; /// The final word in Minecraft server scanners #[derive(Debug, Parser)] -#[command(author, version = metadata::format(), about, long_about = None)] +#[command(version = metadata::format(), about, subcommand_required = true)] pub struct Arguments { /// Amount of information to log #[arg(short, long, default_value = "info")] @@ -22,6 +22,8 @@ pub struct Arguments { #[derive(Debug, Subcommand)] pub enum MainSubcommand { + Start, + /// Manipulate openheimer configuration files Configuration { #[command(subcommand)] diff --git a/src/core.rs b/src/core.rs new file mode 100644 index 0000000..758449c --- /dev/null +++ b/src/core.rs @@ -0,0 +1,64 @@ +use crate::{arguments::Arguments, configuration::Configuration, metadata}; +use std::{process::exit, str::FromStr}; +use tracing::{debug, info, trace, warn}; +use tracing_subscriber::prelude::*; + +pub fn main(arguments: &Arguments) -> bool { + let (is_default, options) = get_options(arguments); + + setup_logging(options.clone()); + + info!("openheimer {}", metadata::format()); + if is_default { + warn!("falling back to default configuration!"); + } + debug!("using configuration: {options:#?}"); + + true +} + +fn get_options(arguments: &Arguments) -> (bool, Configuration) { + if let Some(configuration_file) = &arguments.configuration_file { + trace!("reading configuration file..."); + let file_contents = match std::fs::read_to_string(configuration_file) { + Ok(file_contents) => file_contents, + Err(error) => { + eprintln!("unable to read configuration file: {error}\n"); + exit(1); + } + }; + + trace!("parsing configuration file..."); + match Configuration::from_str(file_contents.as_str()) { + Ok(options) => (false, options), + Err(error) => { + eprintln!("unable to read configuration file: {error}\n"); + exit(1); + } + } + } else { + (true, Configuration::default()) + } +} + +fn setup_logging(options: Configuration) { + let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( + options.logger.directory, + options.logger.prefix, + )); + let file_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true) + .with_writer(file_appender); + let console_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true); + + let subscriber = tracing_subscriber::Registry::default() + .with(file_layer) + .with(console_layer); + match tracing::subscriber::set_global_default(subscriber) { + Ok(()) => (), + Err(error) => eprintln!("unable to set up logging: {error}"), + }; +} diff --git a/src/main.rs b/src/main.rs index 7997edb..a4ebe44 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,82 +1,22 @@ mod arguments; mod configuration; +mod core; mod database; mod metadata; mod minecraft; -use crate::{arguments::MainSubcommand, configuration::Configuration}; +use crate::arguments::MainSubcommand; use arguments::Arguments; use clap::Parser; -use std::{process::exit, str::FromStr}; -use tracing::{debug, info, trace, warn}; -use tracing_subscriber::prelude::*; fn main() { let arguments = Arguments::parse(); if let Some(ref subcommand) = arguments.subcommand { - let quit = match subcommand { + match subcommand { + MainSubcommand::Start => core::main(&arguments), MainSubcommand::Configuration { subcommand } => { arguments::configuration::parse(&arguments, subcommand) } }; - if quit { - return; - } } - - let (is_default, options) = get_options(arguments); - - setup_logging(options.clone()); - - info!("openheimer {}", metadata::format()); - if is_default { - warn!("falling back to default configuration!"); - } - debug!("using configuration: {options:#?}"); -} - -fn get_options(arguments: Arguments) -> (bool, Configuration) { - if let Some(configuration_file) = arguments.configuration_file { - trace!("reading configuration file..."); - let file_contents = match std::fs::read_to_string(configuration_file) { - Ok(file_contents) => file_contents, - Err(error) => { - eprintln!("unable to read configuration file: {error}\n"); - exit(1); - } - }; - - trace!("parsing configuration file..."); - match Configuration::from_str(file_contents.as_str()) { - Ok(options) => (false, options), - Err(error) => { - eprintln!("unable to read configuration file: {error}\n"); - exit(1); - } - } - } else { - (true, Configuration::default()) - } -} - -fn setup_logging(options: Configuration) { - let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( - options.logger.directory, - options.logger.prefix, - )); - let file_layer = tracing_subscriber::fmt::layer() - .with_file(true) - .with_line_number(true) - .with_writer(file_appender); - let console_layer = tracing_subscriber::fmt::layer() - .with_file(true) - .with_line_number(true); - - let subscriber = tracing_subscriber::Registry::default() - .with(file_layer) - .with(console_layer); - match tracing::subscriber::set_global_default(subscriber) { - Ok(()) => (), - Err(error) => eprintln!("unable to set up logging: {error}"), - }; } From 63df4e58cdc43f7c7e5732a0f60019d8d0a85739 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:21:34 +0800 Subject: [PATCH 076/132] test: add basic logging test --- src/core.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core.rs b/src/core.rs index 758449c..87a37c8 100644 --- a/src/core.rs +++ b/src/core.rs @@ -6,7 +6,7 @@ use tracing_subscriber::prelude::*; pub fn main(arguments: &Arguments) -> bool { let (is_default, options) = get_options(arguments); - setup_logging(options.clone()); + set_up_logging(options.clone()); info!("openheimer {}", metadata::format()); if is_default { @@ -41,7 +41,7 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { } } -fn setup_logging(options: Configuration) { +fn set_up_logging(options: Configuration) { let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( options.logger.directory, options.logger.prefix, @@ -62,3 +62,20 @@ fn setup_logging(options: Configuration) { Err(error) => eprintln!("unable to set up logging: {error}"), }; } + +#[cfg(test)] +mod test { + use super::set_up_logging; + use crate::configuration::Configuration; + use tracing::{debug, error, info, trace, warn}; + + #[test] + fn log_messages() { + set_up_logging(Configuration::default()); + error!("h"); + warn!("e"); + info!("l"); + debug!("l"); + trace!("o"); + } +} From 07df3e584292008d83b63bacbb9d1e8634231905 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:22:07 +0800 Subject: [PATCH 077/132] chore(TODO): update --- docs/TODO.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/TODO.md b/docs/TODO.md index 206d5fd..df13555 100644 --- a/docs/TODO.md +++ b/docs/TODO.md @@ -1,8 +1,7 @@ - [ ] GitHub projects - [x] Rewrite logging using `tracing` -- [ ] Add a few basic tests +- [x] Add a few basic tests - [x] (nix) Read version from Cargo.toml - [x] Reflect git commit hash in clap -- [ ] Implement proper error enums -- [ ] Add sled as database provider +- [x] Implement proper error enums From c2b3c3efc3203f6d87e045420ccc25a0b7b4c6bb Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:28:52 +0800 Subject: [PATCH 078/132] chore(TODO): switch to github projects --- docs/TODO.md | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 docs/TODO.md diff --git a/docs/TODO.md b/docs/TODO.md deleted file mode 100644 index df13555..0000000 --- a/docs/TODO.md +++ /dev/null @@ -1,7 +0,0 @@ -- [ ] GitHub projects - -- [x] Rewrite logging using `tracing` -- [x] Add a few basic tests -- [x] (nix) Read version from Cargo.toml -- [x] Reflect git commit hash in clap -- [x] Implement proper error enums From 11fc020359cad828e38a777b5f25e497d93da0da Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:30:33 +0800 Subject: [PATCH 079/132] chore: add dependabot --- .github/dependabot.yml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5a5dddb --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 + +updates: + - package-ecosystem: cargo + directory: /oppnamastaren + schedule: + interval: daily From bfc5e69f178d5043e9dfc22b51b54e3f778efc9d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:51:46 +0800 Subject: [PATCH 080/132] ci: rust and nix workflows --- .github/workflows/nix-check.yaml | 35 ++++++++++++++++++++++++ .github/workflows/nix-lint.yaml | 36 +++++++++++++++++++++++++ .github/workflows/rust-check.yaml | 40 ++++++++++++++++++++++++++++ .github/workflows/rust-lint.yaml | 44 +++++++++++++++++++++++++++++++ 4 files changed, 155 insertions(+) create mode 100644 .github/workflows/nix-check.yaml create mode 100644 .github/workflows/nix-lint.yaml create mode 100644 .github/workflows/rust-check.yaml create mode 100644 .github/workflows/rust-lint.yaml diff --git a/.github/workflows/nix-check.yaml b/.github/workflows/nix-check.yaml new file mode 100644 index 0000000..dc06daf --- /dev/null +++ b/.github/workflows/nix-check.yaml @@ -0,0 +1,35 @@ +name: Nix +on: + push: + paths: + - '**.nix' + - flake.lock + pull_request: + workflow_dispatch: + +jobs: + check-flake: + name: Check flake + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Check Nix flake inputs + uses: DeterminateSystems/flake-checker-action@v5 + with: + fail-mode: true + check-outdated: false + + - name: Check Nix flake outputs + run: nix flake check -v --all-systems diff --git a/.github/workflows/nix-lint.yaml b/.github/workflows/nix-lint.yaml new file mode 100644 index 0000000..83f53b9 --- /dev/null +++ b/.github/workflows/nix-lint.yaml @@ -0,0 +1,36 @@ +name: Nix +on: + push: + paths: + - '**.nix' + pull_request: + workflow_dispatch: + +jobs: + lint-flake: + name: Lint + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Check formatting + run: nix run nixpkgs#alejandra -- -c . + + - name: Run static code analysis + if: always() + run: nix run nixpkgs#statix -- check + + - name: Scan for dead code + if: always() + run: nix run nixpkgs#deadnix -- -f diff --git a/.github/workflows/rust-check.yaml b/.github/workflows/rust-check.yaml new file mode 100644 index 0000000..0513a78 --- /dev/null +++ b/.github/workflows/rust-check.yaml @@ -0,0 +1,40 @@ +name: Rust +on: + push: + paths: + - '**.rs' + - Cargo.* + pull_request: + workflow_dispatch: + +jobs: + unit-tests: + name: Unit tests + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Set up build cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: build-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('flake.nix') }}-${{ hashFiles('**.lock') }} + + - name: Run cargo test + run: nix develop -c cargo test diff --git a/.github/workflows/rust-lint.yaml b/.github/workflows/rust-lint.yaml new file mode 100644 index 0000000..eff95f4 --- /dev/null +++ b/.github/workflows/rust-lint.yaml @@ -0,0 +1,44 @@ +name: Rust +on: + push: + paths: + - '**.rs' + - Cargo.* + pull_request: + workflow_dispatch: + +jobs: + lint: + name: Lint + runs-on: ubuntu-22.04 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Set up build cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: build-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('flake.nix') }}-${{ hashFiles('**.lock') }} + + - name: Run cargo clippy + run: nix develop -c cargo clippy -- -W clippy::pedantic + + - name: Run cargo fmt + if: always() + run: nix develop -c cargo fmt --check From 002b1cece7615ce80e7ef80d2b2278ca2fda3f26 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:53:34 +0800 Subject: [PATCH 081/132] refactor: public minecraft objects --- src/minecraft/player.rs | 10 ++++------ src/minecraft/server.rs | 36 +++++++++++++++++------------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/src/minecraft/player.rs b/src/minecraft/player.rs index 8eb955b..6f7047e 100644 --- a/src/minecraft/player.rs +++ b/src/minecraft/player.rs @@ -2,11 +2,9 @@ use serde::Serialize; #[derive(Clone, Default, Serialize)] pub struct Player { - first_seen: u64, - last_seen: u64, + pub first_seen: u64, + pub last_seen: u64, - name: String, - uuid: String, + pub name: String, + pub uuid: String, } - -impl Player {} diff --git a/src/minecraft/server.rs b/src/minecraft/server.rs index 763c070..675b213 100644 --- a/src/minecraft/server.rs +++ b/src/minecraft/server.rs @@ -2,24 +2,22 @@ use serde::Serialize; #[derive(Clone, Default, Serialize)] pub struct Server { - address: String, - offline_mode: bool, - whitelisted: bool, - first_seen: u64, - last_seen: u64, - extra_data_json: String, + pub address: String, + pub offline_mode: bool, + pub whitelisted: bool, + pub first_seen: u64, + pub last_seen: u64, + pub extra_data_json: String, - version_name: String, - protocol_version: i32, - favicon: String, - description: String, - description_json: String, - players_online: i32, - players_max: i32, - players_json: String, - mod_info_type: String, - mod_info_list_json: String, - enforces_secure_chat: bool, + pub version_name: String, + pub protocol_version: i32, + pub favicon: String, + pub description: String, + pub description_json: String, + pub players_online: i32, + pub players_max: i32, + pub players_json: String, + pub mod_info_type: String, + pub mod_info_list_json: String, + pub enforces_secure_chat: bool, } - -impl Server {} From d2d6446655950c7140cbf7f165118c4f78b78c3a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 13:58:06 +0800 Subject: [PATCH 082/132] ci: organize workflows --- .../workflows/{rust-check.yaml => check.yaml} | 32 +++++++++++++++- .../workflows/{rust-lint.yaml => lint.yaml} | 37 +++++++++++++++++-- .github/workflows/nix-check.yaml | 35 ------------------ .github/workflows/nix-lint.yaml | 36 ------------------ 4 files changed, 63 insertions(+), 77 deletions(-) rename .github/workflows/{rust-check.yaml => check.yaml} (55%) rename .github/workflows/{rust-lint.yaml => lint.yaml} (56%) delete mode 100644 .github/workflows/nix-check.yaml delete mode 100644 .github/workflows/nix-lint.yaml diff --git a/.github/workflows/rust-check.yaml b/.github/workflows/check.yaml similarity index 55% rename from .github/workflows/rust-check.yaml rename to .github/workflows/check.yaml index 0513a78..1585159 100644 --- a/.github/workflows/rust-check.yaml +++ b/.github/workflows/check.yaml @@ -1,9 +1,11 @@ -name: Rust +name: Check on: push: paths: + - '**.nix' - '**.rs' - Cargo.* + - flake.lock pull_request: workflow_dispatch: @@ -13,7 +15,7 @@ jobs: runs-on: ubuntu-22.04 steps: - - name: Checkout repository + - name: Clone repository uses: actions/checkout@v3 - name: Install Nix @@ -38,3 +40,29 @@ jobs: - name: Run cargo test run: nix develop -c cargo test + + nix-flake: + name: Nix flake + runs-on: ubuntu-22.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Check Nix flake inputs + uses: DeterminateSystems/flake-checker-action@v5 + with: + fail-mode: true + check-outdated: false + + - name: Check Nix flake outputs + run: nix flake check -v --all-systems diff --git a/.github/workflows/rust-lint.yaml b/.github/workflows/lint.yaml similarity index 56% rename from .github/workflows/rust-lint.yaml rename to .github/workflows/lint.yaml index eff95f4..95173f4 100644 --- a/.github/workflows/rust-lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,19 +1,20 @@ -name: Rust +name: Lint on: push: paths: + - '**.nix' - '**.rs' - Cargo.* pull_request: workflow_dispatch: jobs: - lint: - name: Lint + rust: + name: Rust runs-on: ubuntu-22.04 steps: - - name: Checkout repository + - name: Clone repository uses: actions/checkout@v3 - name: Install Nix @@ -42,3 +43,31 @@ jobs: - name: Run cargo fmt if: always() run: nix develop -c cargo fmt --check + + nix-flake: + name: Nix flake + runs-on: ubuntu-22.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Check formatting + run: nix run nixpkgs#alejandra -- -c . + + - name: Run static code analysis + if: always() + run: nix run nixpkgs#statix -- check + + - name: Scan for dead code + if: always() + run: nix run nixpkgs#deadnix -- -f diff --git a/.github/workflows/nix-check.yaml b/.github/workflows/nix-check.yaml deleted file mode 100644 index dc06daf..0000000 --- a/.github/workflows/nix-check.yaml +++ /dev/null @@ -1,35 +0,0 @@ -name: Nix -on: - push: - paths: - - '**.nix' - - flake.lock - pull_request: - workflow_dispatch: - -jobs: - check-flake: - name: Check flake - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v9 - with: - extra-conf: | - log-lines = 500 - - - name: Set up Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - name: Check Nix flake inputs - uses: DeterminateSystems/flake-checker-action@v5 - with: - fail-mode: true - check-outdated: false - - - name: Check Nix flake outputs - run: nix flake check -v --all-systems diff --git a/.github/workflows/nix-lint.yaml b/.github/workflows/nix-lint.yaml deleted file mode 100644 index 83f53b9..0000000 --- a/.github/workflows/nix-lint.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Nix -on: - push: - paths: - - '**.nix' - pull_request: - workflow_dispatch: - -jobs: - lint-flake: - name: Lint - runs-on: ubuntu-22.04 - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Install Nix - uses: DeterminateSystems/nix-installer-action@v9 - with: - extra-conf: | - log-lines = 500 - - - name: Set up Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v2 - - - name: Check formatting - run: nix run nixpkgs#alejandra -- -c . - - - name: Run static code analysis - if: always() - run: nix run nixpkgs#statix -- check - - - name: Scan for dead code - if: always() - run: nix run nixpkgs#deadnix -- -f From ff31a02594062f2c054f74ed31dd101b33ee507e Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:01:29 +0800 Subject: [PATCH 083/132] refactor: clean up flake --- flake.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index 99fe7c8..dede8de 100644 --- a/flake.nix +++ b/flake.nix @@ -18,8 +18,8 @@ inherit system; overlays = [rust-overlay.overlays.default]; }; - pkgsStatic = pkgs.pkgsStatic; - pkgsCross = pkgs.pkgsCross; + inherit (pkgs) pkgsStatic; + inherit (pkgs) pkgsCross; rust = pkgs.rust-bin.nightly.latest.default.override { targets = [ From 4a06d74c8f97291b54a9055a20ccefbb37ac6b91 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:03:13 +0800 Subject: [PATCH 084/132] refactor(flake): remove dead code --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index dede8de..fb84355 100644 --- a/flake.nix +++ b/flake.nix @@ -8,10 +8,10 @@ }; outputs = { - self, nixpkgs, flake-utils, rust-overlay, + ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { From fd9266b947a6d78522cd4aba3ab15e7373252171 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:04:02 +0800 Subject: [PATCH 085/132] refactor(flake): devShell -> devShells.default --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index fb84355..16a0cd7 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,7 @@ ]; }; in rec { - devShell = pkgs.mkShell { + devShells.default = pkgs.mkShell { name = "openheimer"; buildInputs = with pkgs; [ clang From dc1f3e7f2b6a6ce4773d933de41f5ad3827c2145 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:20:59 +0800 Subject: [PATCH 086/132] chore(flake): switch to flake-parts --- flake.lock | 69 ++++++++++++++++--------------- flake.nix | 117 ++++++++++++++++++++++++++++------------------------- 2 files changed, 98 insertions(+), 88 deletions(-) diff --git a/flake.lock b/flake.lock index 36b008a..c2f944f 100644 --- a/flake.lock +++ b/flake.lock @@ -1,26 +1,26 @@ { "nodes": { - "flake-utils": { + "flake-parts": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "lastModified": 1704982712, + "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "07f6395285469419cf9d078f59b5b49993198c00", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, - "flake-utils_2": { + "flake-utils": { "inputs": { - "systems": "systems_2" + "systems": "systems" }, "locked": { "lastModified": 1681202837, @@ -38,15 +38,33 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703255338, - "narHash": "sha256-Z6wfYJQKmDN9xciTwU3cOiOk+NElxdZwy/FiHctCzjU=", - "owner": "nixos", + "lastModified": 1706191920, + "narHash": "sha256-eLihrZAPZX0R6RyM5fYAWeKVNuQPYjAkCUBr+JNvtdE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ae5c332cbb5827f6b1f02572496b141021de335f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "6df37dc6a77654682fe9f071c62b4242b5342e04", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", "type": "github" }, "original": { - "owner": "nixos", + "dir": "lib", + "owner": "NixOS", "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" @@ -70,14 +88,14 @@ }, "root": { "inputs": { - "flake-utils": "flake-utils", + "flake-parts": "flake-parts", "nixpkgs": "nixpkgs", "rust-overlay": "rust-overlay" } }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_2", + "flake-utils": "flake-utils", "nixpkgs": "nixpkgs_2" }, "locked": { @@ -108,21 +126,6 @@ "repo": "default", "type": "github" } - }, - "systems_2": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 16a0cd7..8ee4bf4 100644 --- a/flake.nix +++ b/flake.nix @@ -2,72 +2,79 @@ description = "openheimer"; inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { nixpkgs, - flake-utils, + flake-parts, rust-overlay, ... - }: - flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { - inherit system; - overlays = [rust-overlay.overlays.default]; - }; - inherit (pkgs) pkgsStatic; - inherit (pkgs) pkgsCross; + } @ inputs: + flake-parts.lib.mkFlake {inherit inputs;} { + systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"]; + perSystem = { + system, + pkgs, + ... + }: let + inherit (pkgs) pkgsStatic; + inherit (pkgs) pkgsCross; + rust = pkgs.rust-bin.nightly.latest.default.override { + targets = [ + "x86_64-unknown-linux-gnu" + "x86_64-unknown-linux-musl" + "i686-unknown-linux-musl" + "x86_64-pc-windows-gnu" + ]; + extensions = [ + "rust-src" + "rust-analyzer-preview" + ]; + }; + in rec { + _module.args.pkgs = import inputs.nixpkgs { + inherit system; + overlays = [rust-overlay.overlays.default]; + }; - rust = pkgs.rust-bin.nightly.latest.default.override { - targets = [ - "x86_64-unknown-linux-gnu" - "x86_64-unknown-linux-musl" - "i686-unknown-linux-musl" - "x86_64-pc-windows-gnu" - ]; - extensions = [ - "rust-src" - "rust-analyzer-preview" - ]; - }; - in rec { - devShells.default = pkgs.mkShell { - name = "openheimer"; - buildInputs = with pkgs; [ - clang - libgit2 - mold - pkgsCross.mingwW64.buildPackages.gcc - rust - ]; + devShells.default = pkgs.mkShell { + name = "openheimer"; + buildInputs = with pkgs; [ + clang + libgit2 + mold + pkgsCross.mingwW64.buildPackages.gcc + rust + ]; - CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = "-L native=${pkgsCross.mingwW64.windows.mingw_w64_pthreads}/lib"; - LIBZ_SYS_STATIC = 1; - OPENSSL_DIR = pkgsStatic.openssl.dev; - OPENSSL_LIB_DIR = "${pkgsStatic.openssl.out}/lib"; - OPENSSL_STATIC = 1; - PKG_CONFIG_ALL_STATIC = true; - PKG_CONFIG_ALLOW_CROSS = true; - RUST_BACKTRACE = 1; - }; + CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = "-L native=${pkgsCross.mingwW64.windows.mingw_w64_pthreads}/lib"; + LIBZ_SYS_STATIC = 1; + OPENSSL_DIR = pkgsStatic.openssl.dev; + OPENSSL_LIB_DIR = "${pkgsStatic.openssl.out}/lib"; + OPENSSL_STATIC = 1; + PKG_CONFIG_ALL_STATIC = true; + PKG_CONFIG_ALLOW_CROSS = true; + RUST_BACKTRACE = 1; + }; - packages.openheimer = pkgs.rustPlatform.buildRustPackage { - pname = "openheimer"; - version = "dev"; + packages.openheimer = pkgs.rustPlatform.buildRustPackage { + pname = "openheimer"; + version = "dev"; - cargoLock.lockFile = ./Cargo.lock; - src = pkgs.lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; + src = pkgs.lib.cleanSource ./.; - nativeBuildInputs = with pkgs; [ - clang - libgit2 - mold - rust - ]; + nativeBuildInputs = with pkgs; [ + clang + libgit2 + mold + rust + ]; + }; + packages.default = packages.openheimer; }; - defaultPackage = packages.openheimer; - }); + }; } From 3423f368b3c1e161d6d625ff5b681378d671abd2 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:24:09 +0800 Subject: [PATCH 087/132] ci: add cachix --- .github/workflows/check.yaml | 6 ++++++ .github/workflows/lint.yaml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 1585159..e058f43 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -27,6 +27,12 @@ jobs: - name: Set up Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v2 + - name: Set up Cachix + uses: cachix/cachix-action@v13 + with: + name: errornobinaries + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - name: Set up build cache uses: actions/cache@v4 with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 95173f4..2547d24 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -26,6 +26,12 @@ jobs: - name: Set up Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v2 + - name: Set up Cachix + uses: cachix/cachix-action@v13 + with: + name: errornobinaries + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + - name: Set up build cache uses: actions/cache@v4 with: From 99507f0df5baad23db11b8a87588b313508cf035 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:26:10 +0800 Subject: [PATCH 088/132] ci: tweak job name --- .github/workflows/lint.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 2547d24..d3b77bb 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -9,8 +9,8 @@ on: workflow_dispatch: jobs: - rust: - name: Rust + rust-code: + name: Rust code runs-on: ubuntu-22.04 steps: From 360ef03ad3ff8055202d5ca5313a168e3d5a1eab Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:28:52 +0800 Subject: [PATCH 089/132] refactor(flake): format --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index 8ee4bf4..ccdba4b 100644 --- a/flake.nix +++ b/flake.nix @@ -22,6 +22,7 @@ }: let inherit (pkgs) pkgsStatic; inherit (pkgs) pkgsCross; + rust = pkgs.rust-bin.nightly.latest.default.override { targets = [ "x86_64-unknown-linux-gnu" @@ -42,6 +43,7 @@ devShells.default = pkgs.mkShell { name = "openheimer"; + buildInputs = with pkgs; [ clang libgit2 From 70bef5c231dd9c63a578fc0ddfe46b886f22142c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:33:55 +0800 Subject: [PATCH 090/132] ci: treat warnings as errors --- .github/workflows/lint.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index d3b77bb..43f420f 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -44,7 +44,7 @@ jobs: key: build-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('flake.nix') }}-${{ hashFiles('**.lock') }} - name: Run cargo clippy - run: nix develop -c cargo clippy -- -W clippy::pedantic + run: nix develop -c cargo clippy -- -Dwarnings -Wclippy::pedantic - name: Run cargo fmt if: always() From 23ce454e8382d5fc8ee1d746a7d7d721f7dc72d7 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:45:56 +0800 Subject: [PATCH 091/132] refactor: remove bool returns --- src/arguments/configuration.rs | 8 +++----- src/core.rs | 4 +--- src/main.rs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/arguments/configuration.rs b/src/arguments/configuration.rs index f04412e..b3d92a5 100644 --- a/src/arguments/configuration.rs +++ b/src/arguments/configuration.rs @@ -2,19 +2,18 @@ use super::{Arguments, ConfigurationSubcommand}; use crate::configuration::Configuration; use std::str::FromStr; -pub fn parse(arguments: &Arguments, subcommand: &ConfigurationSubcommand) -> bool { +pub fn parse(arguments: &Arguments, subcommand: &ConfigurationSubcommand) { match subcommand { ConfigurationSubcommand::Default => default(), ConfigurationSubcommand::Fill => fill(arguments), } } -fn default() -> bool { +fn default() { println!("{}", Configuration::default().to_string()); - true } -fn fill(arguments: &Arguments) -> bool { +fn fill(arguments: &Arguments) { let default = Configuration::default(); let options = if let Some(configuration_file) = &arguments.configuration_file { let file_contents = match std::fs::read_to_string(configuration_file) { @@ -37,5 +36,4 @@ fn fill(arguments: &Arguments) -> bool { }; println!("{}", options.to_string()); - true } diff --git a/src/core.rs b/src/core.rs index 87a37c8..1c5cc0e 100644 --- a/src/core.rs +++ b/src/core.rs @@ -3,7 +3,7 @@ use std::{process::exit, str::FromStr}; use tracing::{debug, info, trace, warn}; use tracing_subscriber::prelude::*; -pub fn main(arguments: &Arguments) -> bool { +pub fn main(arguments: &Arguments) { let (is_default, options) = get_options(arguments); set_up_logging(options.clone()); @@ -13,8 +13,6 @@ pub fn main(arguments: &Arguments) -> bool { warn!("falling back to default configuration!"); } debug!("using configuration: {options:#?}"); - - true } fn get_options(arguments: &Arguments) -> (bool, Configuration) { diff --git a/src/main.rs b/src/main.rs index a4ebe44..3a4566c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -15,7 +15,7 @@ fn main() { match subcommand { MainSubcommand::Start => core::main(&arguments), MainSubcommand::Configuration { subcommand } => { - arguments::configuration::parse(&arguments, subcommand) + arguments::configuration::parse(&arguments, subcommand); } }; } From ebcbf148085d9045affd6fe16ec8e171fd074910 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 14:52:16 +0800 Subject: [PATCH 092/132] ci: remove cachix --- .github/workflows/check.yaml | 6 ------ .github/workflows/lint.yaml | 6 ------ 2 files changed, 12 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index e058f43..1585159 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -27,12 +27,6 @@ jobs: - name: Set up Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v2 - - name: Set up Cachix - uses: cachix/cachix-action@v13 - with: - name: errornobinaries - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Set up build cache uses: actions/cache@v4 with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 43f420f..69d67ae 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -26,12 +26,6 @@ jobs: - name: Set up Magic Nix Cache uses: DeterminateSystems/magic-nix-cache-action@v2 - - name: Set up Cachix - uses: cachix/cachix-action@v13 - with: - name: errornobinaries - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Set up build cache uses: actions/cache@v4 with: From e43203e270bfd123efa7733c53de3fffc4f00954 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 15:09:33 +0800 Subject: [PATCH 093/132] fix: remove target cpu To make things reproducible. --- .cargo/config.toml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index b31de2c..83544f2 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,6 +1,3 @@ -[build] -rustflags = ["-C", "target-cpu=native"] - [target.x86_64-unknown-linux-gnu] linker = "clang" rustflags = ["-C", "link-arg=-fuse-ld=mold"] From ab7335e9ba5a3cc1a4ef64bb8a423e6f11695250 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 15:10:31 +0800 Subject: [PATCH 094/132] refactor: sqlite3 -> sqlite --- src/configuration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuration.rs b/src/configuration.rs index 585a6ce..068f724 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -34,7 +34,7 @@ pub struct Database { impl Default for Database { fn default() -> Self { Self { - provider: "sqlite3".into(), + provider: "sqlite".into(), location: "openheimer.db".into(), } } From 3f0e8031eb2c726df184e1ba0169dfd427d759b6 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 16:38:30 +0800 Subject: [PATCH 095/132] refactor: acquire_connection helper --- src/database/sqlite.rs | 51 ++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 8f714f1..ab88eb6 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -1,7 +1,7 @@ use super::Error; use crate::minecraft::{player::Player, server::Server}; use async_trait::async_trait; -use sqlx::sqlite::SqlitePoolOptions; +use sqlx::{pool::PoolConnection, sqlite::SqlitePoolOptions}; pub struct Database { pool: sqlx::SqlitePool, @@ -21,12 +21,8 @@ impl super::Database for Database { } async fn add_server(&mut self, server: &Server) -> Result<(), Error> { - let mut connection = match self.pool.acquire().await { - Ok(connection) => connection, - Err(error) => return Err(Error::Acquire(error)), - }; - - let serialized_server = serialize(server)?; + let mut connection = self.acquire_connection().await?; + let serialized_server = Database::serialize(server)?; match sqlx::query("INSERT INTO servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) .execute(&mut *connection) @@ -38,12 +34,8 @@ impl super::Database for Database { } async fn add_player(&mut self, player: &Player) -> Result<(), Error> { - let mut connection = match self.pool.acquire().await { - Ok(connection) => connection, - Err(error) => return Err(Error::Acquire(error)), - }; - - let serialized_player = serialize(player)?; + let mut connection = self.acquire_connection().await?; + let serialized_player = Database::serialize(player)?; match sqlx::query("INSERT INTO players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) .execute(&mut *connection) @@ -55,12 +47,8 @@ impl super::Database for Database { } async fn add_targeted_server(&mut self, server: &Server) -> Result<(), Error> { - let mut connection = match self.pool.acquire().await { - Ok(connection) => connection, - Err(error) => return Err(Error::Acquire(error)), - }; - - let serialized_server = serialize(server)?; + let mut connection = self.acquire_connection().await?; + let serialized_server = Database::serialize(server)?; match sqlx::query("INSERT INTO targeted_servers ( serialized_server ) VALUES ( ?1 )") .bind(serialized_server) .execute(&mut *connection) @@ -72,12 +60,8 @@ impl super::Database for Database { } async fn add_targeted_player(&mut self, player: &Player) -> Result<(), Error> { - let mut connection = match self.pool.acquire().await { - Ok(connection) => connection, - Err(error) => return Err(Error::Acquire(error)), - }; - - let serialized_player = serialize(player)?; + let mut connection = self.acquire_connection().await?; + let serialized_player = Database::serialize(player)?; match sqlx::query("INSERT INTO targeted_players ( serialized_player ) VALUES ( ?1 )") .bind(serialized_player) .execute(&mut *connection) @@ -89,9 +73,18 @@ impl super::Database for Database { } } -fn serialize(object: T) -> Result { - match serde_json::to_string(&object) { - Ok(serialized) => Ok(serialized), - Err(error) => Err(super::Error::Serialize(error)), +impl Database { + pub async fn acquire_connection(&mut self) -> Result, Error> { + match self.pool.acquire().await { + Ok(connection) => Ok(connection), + Err(error) => Err(Error::Acquire(error)), + } + } + + pub fn serialize(object: T) -> Result { + match serde_json::to_string(&object) { + Ok(serialized) => Ok(serialized), + Err(error) => Err(super::Error::Serialize(error)), + } } } From 3b6aebe190913af01d9d49e09a7b2329332ac790 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 16:39:33 +0800 Subject: [PATCH 096/132] refactor: make crate public --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 3a4566c..624f621 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,15 @@ -mod arguments; -mod configuration; -mod core; -mod database; -mod metadata; -mod minecraft; +pub mod arguments; +pub mod configuration; +pub mod core; +pub mod database; +pub mod metadata; +pub mod minecraft; use crate::arguments::MainSubcommand; use arguments::Arguments; use clap::Parser; -fn main() { +pub fn main() { let arguments = Arguments::parse(); if let Some(ref subcommand) = arguments.subcommand { match subcommand { From c0a2f710f5ff61a99e35465d8e2fa912474992a6 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 16:43:38 +0800 Subject: [PATCH 097/132] Revert "refactor: make crate public" This reverts commit 3b6aebe190913af01d9d49e09a7b2329332ac790. --- src/main.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index 624f621..3a4566c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,15 +1,15 @@ -pub mod arguments; -pub mod configuration; -pub mod core; -pub mod database; -pub mod metadata; -pub mod minecraft; +mod arguments; +mod configuration; +mod core; +mod database; +mod metadata; +mod minecraft; use crate::arguments::MainSubcommand; use arguments::Arguments; use clap::Parser; -pub fn main() { +fn main() { let arguments = Arguments::parse(); if let Some(ref subcommand) = arguments.subcommand { match subcommand { From dbfb3bea702473d7c89c21a4b65ca14960e669f6 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 16:43:52 +0800 Subject: [PATCH 098/132] chore(gitignore): cleanups --- .gitignore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f11397f..4f53625 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ +lib/npcap + /target -openheimer -openheimer.toml + *.log +openheimer* From 0c8c607061dfc0681442291be6896c76287a1f6c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 16:47:20 +0800 Subject: [PATCH 099/132] chore: +x fetch.sh --- lib/fetch.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 lib/fetch.sh diff --git a/lib/fetch.sh b/lib/fetch.sh old mode 100644 new mode 100755 From 919cbac66b164c7a884397e586c3b5118dede499 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 19:18:35 +0800 Subject: [PATCH 100/132] chore: minor cleanups --- .github/workflows/check.yaml | 2 +- .github/workflows/lint.yaml | 2 +- flake.nix | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index 1585159..c81eed5 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -16,7 +16,7 @@ jobs: steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Nix uses: DeterminateSystems/nix-installer-action@v9 diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 69d67ae..c999cf6 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -15,7 +15,7 @@ jobs: steps: - name: Clone repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Nix uses: DeterminateSystems/nix-installer-action@v9 diff --git a/flake.nix b/flake.nix index ccdba4b..b0cb492 100644 --- a/flake.nix +++ b/flake.nix @@ -36,7 +36,7 @@ ]; }; in rec { - _module.args.pkgs = import inputs.nixpkgs { + _module.args.pkgs = import nixpkgs { inherit system; overlays = [rust-overlay.overlays.default]; }; From cb21c6c40d927933b211abede60b7b4e501a2ec7 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 19:21:54 +0800 Subject: [PATCH 101/132] tweak(cargo): release mode options --- Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index fbb02d4..28d91fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,8 @@ built = { version = "0.7", features = ["git2"] } [profile.release] codegen-units = 1 lto = true +panic = "abort" +strip = "symbols" trim-paths = "all" [dependencies] From 0a2200328f04897c3245b040c73d425cdbaf38c6 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 19:26:09 +0800 Subject: [PATCH 102/132] chore(deps): update everything --- Cargo.lock | 132 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 65 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index edfe416..a96015e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -53,9 +53,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -152,9 +152,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -170,9 +170,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" dependencies = [ "serde", ] @@ -231,23 +231,23 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] name = "clap" -version = "4.4.13" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -346,22 +346,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc6598521bb5a83d491e8c1fe51db7296019d2ca3cb93cc6c2a20369a4d78a2" +checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" dependencies = [ - "cfg-if", "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.18" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3a430a770ebd84726f584a90ee7f020d28db52c6d02138900f22341f866d39c" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -569,9 +565,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -590,7 +586,7 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "libc", "libgit2-sys", "log", @@ -627,9 +623,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "hex" @@ -699,9 +695,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" dependencies = [ "equivalent", "hashbrown", @@ -733,9 +729,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -751,9 +747,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libgit2-sys" @@ -786,9 +782,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "037731f5d3aaa87a5675e895b63ddff1a87624bc29f77004ea829809654e48f6" dependencies = [ "cc", "libc", @@ -798,9 +794,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lock_api" @@ -866,7 +862,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if", "libc", ] @@ -1068,9 +1064,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "powerfmt" @@ -1086,9 +1082,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.76" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1183,11 +1179,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -1248,18 +1244,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.195" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", @@ -1268,9 +1264,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.111" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1347,9 +1343,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -1500,7 +1496,7 @@ checksum = "e37195395df71fd068f6e2082247891bc11e3289624bbc776a0cdfa1ca7f1ea4" dependencies = [ "atoi", "base64", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "bytes", "crc", @@ -1542,7 +1538,7 @@ checksum = "d6ac0ac3b7ccd10cc96c7ab29791a7dd236bd94021f31eec7ba3d46a74aa1c24" dependencies = [ "atoi", "base64", - "bitflags 2.4.1", + "bitflags 2.4.2", "byteorder", "crc", "dotenvy", @@ -1882,9 +1878,9 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -1968,9 +1964,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1978,9 +1974,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -1993,9 +1989,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2003,9 +1999,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -2016,9 +2012,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "webpki-roots" @@ -2197,9 +2193,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.33" +version = "0.5.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7520bbdec7211caa7c4e682eb1fbe07abe20cee6756b6e00f537c82c11816aa" +checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index 28d91fa..15ddb90 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,4 @@ tokio = { version = "1", features = ["full"] } toml = "0.8" tracing = "0.1" tracing-appender = "0.2.3" -tracing-subscriber = { version = "0.3", features = ["time", "registry"] } +tracing-subscriber = { version = "0.3", features = ["time"] } From b4b9267e57e0f3752d86e7bb89a47d1512836855 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 19:43:57 +0800 Subject: [PATCH 103/132] fix: file logging --- src/core.rs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/core.rs b/src/core.rs index 1c5cc0e..85dc0c0 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,12 +1,18 @@ use crate::{arguments::Arguments, configuration::Configuration, metadata}; use std::{process::exit, str::FromStr}; use tracing::{debug, info, trace, warn}; +use tracing_appender::non_blocking::NonBlocking; use tracing_subscriber::prelude::*; pub fn main(arguments: &Arguments) { let (is_default, options) = get_options(arguments); - set_up_logging(options.clone()); + let binding = options.clone(); + let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( + binding.logger.directory, + binding.logger.prefix, + )); + set_up_logging(file_appender); info!("openheimer {}", metadata::format()); if is_default { @@ -39,11 +45,7 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { } } -fn set_up_logging(options: Configuration) { - let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( - options.logger.directory, - options.logger.prefix, - )); +fn set_up_logging(file_appender: NonBlocking) { let file_layer = tracing_subscriber::fmt::layer() .with_file(true) .with_line_number(true) @@ -63,13 +65,19 @@ fn set_up_logging(options: Configuration) { #[cfg(test)] mod test { - use super::set_up_logging; use crate::configuration::Configuration; + use super::set_up_logging; use tracing::{debug, error, info, trace, warn}; #[test] fn log_messages() { - set_up_logging(Configuration::default()); + let configuration = Configuration::default(); + let (file_appender, _guard) = + tracing_appender::non_blocking(tracing_appender::rolling::daily( + configuration.logger.directory, + configuration.logger.prefix, + )); + set_up_logging(file_appender); error!("h"); warn!("e"); info!("l"); From dd335fa6c3637b1b2e4ec0ba957d8d4b997e6df3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:26:54 +0800 Subject: [PATCH 104/132] feat: better logger setup --- src/configuration.rs | 34 +++++++++++++++++++++++++++++++++- src/core.rs | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 59 insertions(+), 16 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index 068f724..bfa3cff 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,5 +1,6 @@ use serde::{Deserialize, Serialize}; use std::str::FromStr; +use tracing_appender::rolling; #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(default)] @@ -12,14 +13,45 @@ pub struct Configuration { #[serde(default)] pub struct Logger { pub directory: String, + pub rotation: LoggerRotation, + pub max_log_files: usize, pub prefix: String, + pub suffix: String, } impl Default for Logger { fn default() -> Self { Self { directory: "openheimer/logs".into(), - prefix: "openheimer.log".into(), + rotation: LoggerRotation::default(), + max_log_files: 100, + prefix: "openheimer".into(), + suffix: "log".into(), + } + } +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +pub enum LoggerRotation { + Never, + Minutely, + Hourly, + Daily, +} + +impl Default for LoggerRotation { + fn default() -> Self { + LoggerRotation::Daily + } +} + +impl Into for LoggerRotation { + fn into(self) -> rolling::Rotation { + match self { + LoggerRotation::Never => rolling::Rotation::NEVER, + LoggerRotation::Minutely => rolling::Rotation::MINUTELY, + LoggerRotation::Hourly => rolling::Rotation::HOURLY, + LoggerRotation::Daily => rolling::Rotation::DAILY, } } } diff --git a/src/core.rs b/src/core.rs index 85dc0c0..136c94c 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,18 +1,25 @@ use crate::{arguments::Arguments, configuration::Configuration, metadata}; use std::{process::exit, str::FromStr}; use tracing::{debug, info, trace, warn}; -use tracing_appender::non_blocking::NonBlocking; +use tracing_appender::rolling::RollingFileAppender; use tracing_subscriber::prelude::*; pub fn main(arguments: &Arguments) { let (is_default, options) = get_options(arguments); let binding = options.clone(); - let (file_appender, _guard) = tracing_appender::non_blocking(tracing_appender::rolling::daily( - binding.logger.directory, - binding.logger.prefix, - )); - set_up_logging(file_appender); + match tracing_appender::rolling::Builder::new() + .filename_prefix(binding.logger.prefix) + .filename_suffix(binding.logger.suffix) + .rotation(options.logger.rotation.clone().into()) + .max_log_files(options.logger.max_log_files) + .build(binding.logger.directory) + { + Ok(file_appender) => set_up_logging(file_appender), + Err(error) => { + eprintln!("unable to set up rolling logger: {error}"); + } + }; info!("openheimer {}", metadata::format()); if is_default { @@ -45,7 +52,7 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { } } -fn set_up_logging(file_appender: NonBlocking) { +fn set_up_logging(file_appender: RollingFileAppender) { let file_layer = tracing_subscriber::fmt::layer() .with_file(true) .with_line_number(true) @@ -65,19 +72,23 @@ fn set_up_logging(file_appender: NonBlocking) { #[cfg(test)] mod test { - use crate::configuration::Configuration; use super::set_up_logging; + use crate::configuration::Configuration; use tracing::{debug, error, info, trace, warn}; #[test] fn log_messages() { - let configuration = Configuration::default(); - let (file_appender, _guard) = - tracing_appender::non_blocking(tracing_appender::rolling::daily( - configuration.logger.directory, - configuration.logger.prefix, - )); - set_up_logging(file_appender); + let options = Configuration::default(); + set_up_logging( + tracing_appender::rolling::Builder::new() + .filename_prefix(options.logger.prefix) + .filename_suffix(options.logger.suffix) + .rotation(options.logger.rotation.clone().into()) + .max_log_files(options.logger.max_log_files) + .build(options.logger.directory) + .expect("should have been able to create logger files"), + ); + error!("h"); warn!("e"); info!("l"); From 3b97fee5c318a710db6f3b55a72118cbcbcd4737 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:35:29 +0800 Subject: [PATCH 105/132] refactor: oxidize --- src/configuration.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/configuration.rs b/src/configuration.rs index bfa3cff..d1ddb35 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -31,23 +31,18 @@ impl Default for Logger { } } -#[derive(Clone, Debug, Deserialize, Serialize)] +#[derive(Clone, Debug, Default, Deserialize, Serialize)] pub enum LoggerRotation { Never, Minutely, Hourly, + #[default] Daily, } -impl Default for LoggerRotation { - fn default() -> Self { - LoggerRotation::Daily - } -} - -impl Into for LoggerRotation { - fn into(self) -> rolling::Rotation { - match self { +impl From for tracing_appender::rolling::Rotation { + fn from(value: LoggerRotation) -> Self { + match value { LoggerRotation::Never => rolling::Rotation::NEVER, LoggerRotation::Minutely => rolling::Rotation::MINUTELY, LoggerRotation::Hourly => rolling::Rotation::HOURLY, From 0f7777494ad613b1bf3c73850d8fc51c0c8b9789 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:37:48 +0800 Subject: [PATCH 106/132] refactor: trim configuration file --- src/configuration.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/configuration.rs b/src/configuration.rs index d1ddb35..25a128d 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -80,6 +80,6 @@ impl FromStr for Configuration { impl ToString for Configuration { fn to_string(&self) -> String { - toml::to_string_pretty(&self).unwrap() + toml::to_string_pretty(&self).unwrap().trim().to_string() } } From 6c9542a8477bc1359651a0d4000ff66e671b2713 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:41:00 +0800 Subject: [PATCH 107/132] feat: better error printing --- src/arguments/configuration.rs | 4 ++-- src/configuration.rs | 9 +++++++-- src/core.rs | 8 ++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/arguments/configuration.rs b/src/arguments/configuration.rs index b3d92a5..784b962 100644 --- a/src/arguments/configuration.rs +++ b/src/arguments/configuration.rs @@ -19,7 +19,7 @@ fn fill(arguments: &Arguments) { let file_contents = match std::fs::read_to_string(configuration_file) { Ok(file_contents) => file_contents, Err(error) => { - eprintln!("unable to read configuration file: {error}"); + eprintln!("unable to read configuration file: {error:#?}"); default.to_string() } }; @@ -27,7 +27,7 @@ fn fill(arguments: &Arguments) { match Configuration::from_str(file_contents.as_str()) { Ok(options) => options, Err(error) => { - eprintln!("unable to parse configuration file: {error}"); + eprintln!("unable to parse configuration file: {error:#?}"); default } } diff --git a/src/configuration.rs b/src/configuration.rs index 25a128d..7e0ec85 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -2,6 +2,11 @@ use serde::{Deserialize, Serialize}; use std::str::FromStr; use tracing_appender::rolling; +#[derive(Debug)] +pub enum Error { + Deserialize(toml::de::Error), +} + #[derive(Clone, Debug, Default, Deserialize, Serialize)] #[serde(default)] pub struct Configuration { @@ -68,12 +73,12 @@ impl Default for Database { } impl FromStr for Configuration { - type Err = String; + type Err = Error; fn from_str(string: &str) -> Result { match toml::from_str(string) { Ok(configuration) => Ok(configuration), - Err(error) => Err(format!("deserialization error: {error:?}")), + Err(error) => Err(Error::Deserialize(error)), } } } diff --git a/src/core.rs b/src/core.rs index 136c94c..3848e05 100644 --- a/src/core.rs +++ b/src/core.rs @@ -17,7 +17,7 @@ pub fn main(arguments: &Arguments) { { Ok(file_appender) => set_up_logging(file_appender), Err(error) => { - eprintln!("unable to set up rolling logger: {error}"); + eprintln!("unable to set up rolling logger: {error:#?}"); } }; @@ -34,7 +34,7 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { let file_contents = match std::fs::read_to_string(configuration_file) { Ok(file_contents) => file_contents, Err(error) => { - eprintln!("unable to read configuration file: {error}\n"); + eprintln!("unable to read configuration file: {error:#?}\n"); exit(1); } }; @@ -43,7 +43,7 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { match Configuration::from_str(file_contents.as_str()) { Ok(options) => (false, options), Err(error) => { - eprintln!("unable to read configuration file: {error}\n"); + eprintln!("unable to read configuration file: {error:#?}\n"); exit(1); } } @@ -66,7 +66,7 @@ fn set_up_logging(file_appender: RollingFileAppender) { .with(console_layer); match tracing::subscriber::set_global_default(subscriber) { Ok(()) => (), - Err(error) => eprintln!("unable to set up logging: {error}"), + Err(error) => eprintln!("unable to set up logging: {error:#?}"), }; } From 8b1edd241f8e760144e40a00ef493ab438c1ac70 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:54:12 +0800 Subject: [PATCH 108/132] feat: better configuration handling --- src/arguments.rs | 7 ++++-- src/arguments/configuration.rs | 42 ++++++++++++++++++++++------------ src/core.rs | 34 ++++++++++++--------------- 3 files changed, 47 insertions(+), 36 deletions(-) diff --git a/src/arguments.rs b/src/arguments.rs index 942e697..56a0078 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -13,8 +13,8 @@ pub struct Arguments { pub verbosity: LevelFilter, /// TOML configuration file path - #[arg(short, long)] - pub configuration_file: Option, + #[arg(short, long, default_value = "openheimer.toml")] + pub configuration_file: String, #[command(subcommand)] pub subcommand: Option, @@ -38,4 +38,7 @@ pub enum ConfigurationSubcommand { /// Add missing options to your existing configuration file Fill, + + /// Check the validity of an existing configuration file + Validate, } diff --git a/src/arguments/configuration.rs b/src/arguments/configuration.rs index 784b962..e821729 100644 --- a/src/arguments/configuration.rs +++ b/src/arguments/configuration.rs @@ -6,6 +6,7 @@ pub fn parse(arguments: &Arguments, subcommand: &ConfigurationSubcommand) { match subcommand { ConfigurationSubcommand::Default => default(), ConfigurationSubcommand::Fill => fill(arguments), + ConfigurationSubcommand::Validate => validate(arguments), } } @@ -15,25 +16,36 @@ fn default() { fn fill(arguments: &Arguments) { let default = Configuration::default(); - let options = if let Some(configuration_file) = &arguments.configuration_file { - let file_contents = match std::fs::read_to_string(configuration_file) { - Ok(file_contents) => file_contents, - Err(error) => { - eprintln!("unable to read configuration file: {error:#?}"); - default.to_string() - } - }; - match Configuration::from_str(file_contents.as_str()) { - Ok(options) => options, + let file_contents = match std::fs::read_to_string(arguments.configuration_file.clone()) { + Ok(file_contents) => file_contents, + Err(error) => { + eprintln!("unable to read configuration file: {error:#?}"); + default.to_string() + } + }; + + let options = match Configuration::from_str(file_contents.as_str()) { + Ok(options) => options, + Err(error) => { + eprintln!("unable to parse configuration file: {error:#?}"); + default + } + }; + + println!("{}", options.to_string()); +} + +fn validate(arguments: &Arguments) { + match std::fs::read_to_string(arguments.configuration_file.clone()) { + Ok(file_contents) => match Configuration::from_str(file_contents.as_str()) { + Ok(_) => println!("no errors found"), Err(error) => { eprintln!("unable to parse configuration file: {error:#?}"); - default } + }, + Err(error) => { + eprintln!("unable to read configuration file: {error:#?}"); } - } else { - default }; - - println!("{}", options.to_string()); } diff --git a/src/core.rs b/src/core.rs index 3848e05..8d849d7 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,5 +1,5 @@ use crate::{arguments::Arguments, configuration::Configuration, metadata}; -use std::{process::exit, str::FromStr}; +use std::str::FromStr; use tracing::{debug, info, trace, warn}; use tracing_appender::rolling::RollingFileAppender; use tracing_subscriber::prelude::*; @@ -29,26 +29,22 @@ pub fn main(arguments: &Arguments) { } fn get_options(arguments: &Arguments) -> (bool, Configuration) { - if let Some(configuration_file) = &arguments.configuration_file { - trace!("reading configuration file..."); - let file_contents = match std::fs::read_to_string(configuration_file) { - Ok(file_contents) => file_contents, - Err(error) => { - eprintln!("unable to read configuration file: {error:#?}\n"); - exit(1); - } - }; + trace!("reading configuration file..."); + let file_contents = match std::fs::read_to_string(arguments.configuration_file.clone()) { + Ok(file_contents) => file_contents, + Err(error) => { + warn!("unable to read configuration file: {error:#?}"); + return (true, Configuration::default()); + } + }; - trace!("parsing configuration file..."); - match Configuration::from_str(file_contents.as_str()) { - Ok(options) => (false, options), - Err(error) => { - eprintln!("unable to read configuration file: {error:#?}\n"); - exit(1); - } + trace!("parsing configuration file..."); + match Configuration::from_str(file_contents.as_str()) { + Ok(options) => (false, options), + Err(error) => { + warn!("unable to parse configuration file: {error:#?}"); + (true, Configuration::default()) } - } else { - (true, Configuration::default()) } } From 41593af98175830056fb179e9c556ff69022be2b Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 20:55:17 +0800 Subject: [PATCH 109/132] refactor: split logging --- src/core.rs | 51 ++------------------------------------------------ src/logging.rs | 47 ++++++++++++++++++++++++++++++++++++++++++++++ src/main.rs | 1 + 3 files changed, 50 insertions(+), 49 deletions(-) create mode 100644 src/logging.rs diff --git a/src/core.rs b/src/core.rs index 8d849d7..de31944 100644 --- a/src/core.rs +++ b/src/core.rs @@ -1,8 +1,6 @@ -use crate::{arguments::Arguments, configuration::Configuration, metadata}; +use crate::{arguments::Arguments, configuration::Configuration, logging, metadata}; use std::str::FromStr; use tracing::{debug, info, trace, warn}; -use tracing_appender::rolling::RollingFileAppender; -use tracing_subscriber::prelude::*; pub fn main(arguments: &Arguments) { let (is_default, options) = get_options(arguments); @@ -15,7 +13,7 @@ pub fn main(arguments: &Arguments) { .max_log_files(options.logger.max_log_files) .build(binding.logger.directory) { - Ok(file_appender) => set_up_logging(file_appender), + Ok(file_appender) => logging::set_up_logging(file_appender), Err(error) => { eprintln!("unable to set up rolling logger: {error:#?}"); } @@ -47,48 +45,3 @@ fn get_options(arguments: &Arguments) -> (bool, Configuration) { } } } - -fn set_up_logging(file_appender: RollingFileAppender) { - let file_layer = tracing_subscriber::fmt::layer() - .with_file(true) - .with_line_number(true) - .with_writer(file_appender); - let console_layer = tracing_subscriber::fmt::layer() - .with_file(true) - .with_line_number(true); - - let subscriber = tracing_subscriber::Registry::default() - .with(file_layer) - .with(console_layer); - match tracing::subscriber::set_global_default(subscriber) { - Ok(()) => (), - Err(error) => eprintln!("unable to set up logging: {error:#?}"), - }; -} - -#[cfg(test)] -mod test { - use super::set_up_logging; - use crate::configuration::Configuration; - use tracing::{debug, error, info, trace, warn}; - - #[test] - fn log_messages() { - let options = Configuration::default(); - set_up_logging( - tracing_appender::rolling::Builder::new() - .filename_prefix(options.logger.prefix) - .filename_suffix(options.logger.suffix) - .rotation(options.logger.rotation.clone().into()) - .max_log_files(options.logger.max_log_files) - .build(options.logger.directory) - .expect("should have been able to create logger files"), - ); - - error!("h"); - warn!("e"); - info!("l"); - debug!("l"); - trace!("o"); - } -} diff --git a/src/logging.rs b/src/logging.rs new file mode 100644 index 0000000..5c3c369 --- /dev/null +++ b/src/logging.rs @@ -0,0 +1,47 @@ +use tracing_appender::rolling::RollingFileAppender; +use tracing_subscriber::prelude::*; + +pub fn set_up_logging(file_appender: RollingFileAppender) { + let file_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true) + .with_writer(file_appender); + let console_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true); + + let subscriber = tracing_subscriber::Registry::default() + .with(file_layer) + .with(console_layer); + match tracing::subscriber::set_global_default(subscriber) { + Ok(()) => (), + Err(error) => eprintln!("unable to set up logging: {error:#?}"), + }; +} + +#[cfg(test)] +mod test { + use super::set_up_logging; + use crate::configuration::Configuration; + use tracing::{debug, error, info, trace, warn}; + + #[test] + fn log_messages() { + let options = Configuration::default(); + set_up_logging( + tracing_appender::rolling::Builder::new() + .filename_prefix(options.logger.prefix) + .filename_suffix(options.logger.suffix) + .rotation(options.logger.rotation.clone().into()) + .max_log_files(options.logger.max_log_files) + .build(options.logger.directory) + .expect("should have been able to create logger files"), + ); + + error!("h"); + warn!("e"); + info!("l"); + debug!("l"); + trace!("o"); + } +} diff --git a/src/main.rs b/src/main.rs index 3a4566c..068784f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ mod arguments; mod configuration; mod core; mod database; +mod logging; mod metadata; mod minecraft; From f44349467aeb9369ebe442335dc0e928c823839a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 22:08:05 +0800 Subject: [PATCH 110/132] fix: verbosity --- src/core.rs | 16 +++--------- src/logging.rs | 66 ++++++++++++++++++++++++++++++++------------------ 2 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/core.rs b/src/core.rs index de31944..9c62dac 100644 --- a/src/core.rs +++ b/src/core.rs @@ -3,21 +3,11 @@ use std::str::FromStr; use tracing::{debug, info, trace, warn}; pub fn main(arguments: &Arguments) { + trace!("getting configuration options..."); let (is_default, options) = get_options(arguments); - let binding = options.clone(); - match tracing_appender::rolling::Builder::new() - .filename_prefix(binding.logger.prefix) - .filename_suffix(binding.logger.suffix) - .rotation(options.logger.rotation.clone().into()) - .max_log_files(options.logger.max_log_files) - .build(binding.logger.directory) - { - Ok(file_appender) => logging::set_up_logging(file_appender), - Err(error) => { - eprintln!("unable to set up rolling logger: {error:#?}"); - } - }; + trace!("setting up logger..."); + logging::set_up_logging(arguments.verbosity, options.logger.clone()); info!("openheimer {}", metadata::format()); if is_default { diff --git a/src/logging.rs b/src/logging.rs index 5c3c369..27152d9 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -1,21 +1,48 @@ -use tracing_appender::rolling::RollingFileAppender; +use crate::configuration; +use tracing::level_filters::LevelFilter; use tracing_subscriber::prelude::*; -pub fn set_up_logging(file_appender: RollingFileAppender) { - let file_layer = tracing_subscriber::fmt::layer() - .with_file(true) - .with_line_number(true) - .with_writer(file_appender); +pub fn set_up_logging(verbosity: LevelFilter, logger_options: configuration::Logger) { let console_layer = tracing_subscriber::fmt::layer() .with_file(true) - .with_line_number(true); + .with_line_number(true) + .with_writer(std::io::stdout); + + match tracing_appender::rolling::Builder::new() + .filename_prefix(logger_options.prefix) + .filename_suffix(logger_options.suffix) + .rotation(logger_options.rotation.clone().into()) + .max_log_files(logger_options.max_log_files) + .build(logger_options.directory) + { + Ok(file_writer) => { + let file_layer = tracing_subscriber::fmt::layer() + .with_file(true) + .with_line_number(true) + .with_writer(file_writer); + + match tracing::subscriber::set_global_default( + tracing_subscriber::Registry::default() + .with(verbosity) + .with(console_layer) + .with(file_layer), + ) { + Ok(()) => (), + Err(error) => eprintln!("unable to set up logging: {error:#?}"), + }; + } + Err(error) => { + eprintln!("unable to set up rolling file logger: {error:#?}"); - let subscriber = tracing_subscriber::Registry::default() - .with(file_layer) - .with(console_layer); - match tracing::subscriber::set_global_default(subscriber) { - Ok(()) => (), - Err(error) => eprintln!("unable to set up logging: {error:#?}"), + match tracing::subscriber::set_global_default( + tracing_subscriber::Registry::default() + .with(verbosity) + .with(console_layer), + ) { + Ok(()) => (), + Err(error) => eprintln!("unable to set up logging: {error:#?}"), + }; + } }; } @@ -23,20 +50,11 @@ pub fn set_up_logging(file_appender: RollingFileAppender) { mod test { use super::set_up_logging; use crate::configuration::Configuration; - use tracing::{debug, error, info, trace, warn}; + use tracing::{debug, error, info, level_filters::LevelFilter, trace, warn}; #[test] fn log_messages() { - let options = Configuration::default(); - set_up_logging( - tracing_appender::rolling::Builder::new() - .filename_prefix(options.logger.prefix) - .filename_suffix(options.logger.suffix) - .rotation(options.logger.rotation.clone().into()) - .max_log_files(options.logger.max_log_files) - .build(options.logger.directory) - .expect("should have been able to create logger files"), - ); + set_up_logging(LevelFilter::TRACE, Configuration::default().logger); error!("h"); warn!("e"); From 08cf60db75b26f829be9d227534d5f5f26787d10 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 29 Jan 2024 23:23:13 +0800 Subject: [PATCH 111/132] refactor: set_up -> init --- src/core.rs | 2 +- src/logging.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/core.rs b/src/core.rs index 9c62dac..bb4ddc2 100644 --- a/src/core.rs +++ b/src/core.rs @@ -7,7 +7,7 @@ pub fn main(arguments: &Arguments) { let (is_default, options) = get_options(arguments); trace!("setting up logger..."); - logging::set_up_logging(arguments.verbosity, options.logger.clone()); + logging::init(arguments.verbosity, options.logger.clone()); info!("openheimer {}", metadata::format()); if is_default { diff --git a/src/logging.rs b/src/logging.rs index 27152d9..06019ec 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -2,7 +2,7 @@ use crate::configuration; use tracing::level_filters::LevelFilter; use tracing_subscriber::prelude::*; -pub fn set_up_logging(verbosity: LevelFilter, logger_options: configuration::Logger) { +pub fn init(verbosity: LevelFilter, logger_options: configuration::Logger) { let console_layer = tracing_subscriber::fmt::layer() .with_file(true) .with_line_number(true) @@ -48,13 +48,13 @@ pub fn set_up_logging(verbosity: LevelFilter, logger_options: configuration::Log #[cfg(test)] mod test { - use super::set_up_logging; + use super::init; use crate::configuration::Configuration; use tracing::{debug, error, info, level_filters::LevelFilter, trace, warn}; #[test] fn log_messages() { - set_up_logging(LevelFilter::TRACE, Configuration::default().logger); + init(LevelFilter::TRACE, Configuration::default().logger); error!("h"); warn!("e"); From 2dff02f8d03829f8c428b63b1cf5428b427c2953 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 00:13:07 +0800 Subject: [PATCH 112/132] ci: build --- .github/workflows/build.yaml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..a9a4960 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,34 @@ +name: Build +on: + push: + paths: + - '**.nix' + - '**.rs' + - Cargo.* + - flake.lock + pull_request: + workflow_dispatch: + +jobs: + openheimer: + name: openheimer + runs-on: ubuntu-22.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Cachix + uses: cachix/cachix-action@v13 + with: + name: errornobinaries + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: Build default package + run: nix build -L From b251bd62f9841d21bdfa5e8a5f335b7faae89de9 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 00:22:56 +0800 Subject: [PATCH 113/132] chore(flake): add curl & unzip --- flake.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flake.nix b/flake.nix index b0cb492..ea86818 100644 --- a/flake.nix +++ b/flake.nix @@ -46,10 +46,12 @@ buildInputs = with pkgs; [ clang + curl libgit2 mold pkgsCross.mingwW64.buildPackages.gcc rust + unzip ]; CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUSTFLAGS = "-L native=${pkgsCross.mingwW64.windows.mingw_w64_pthreads}/lib"; From 07def3f25f5528ff990cfa22482982cfe373dd1d Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 00:43:38 +0800 Subject: [PATCH 114/132] chore(flake): add substituter --- flake.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flake.nix b/flake.nix index ea86818..8bbeac0 100644 --- a/flake.nix +++ b/flake.nix @@ -14,6 +14,11 @@ ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { + flake.nixConfig = { + extra-substituters = ["https://errornobinaries.cachix.org/"]; + extra-trusted-public-keys = ["errornobinaries.cachix.org-1:84oagGNCIsXxBTYmfTiP+lvWje7lIS294iqAtCpFsbU="]; + }; + systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"]; perSystem = { system, From 5ed49ef06c586c16f147b78ab62d7fec180e8a55 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 01:58:49 +0800 Subject: [PATCH 115/132] ci: add release workflow --- .github/workflows/release.yaml | 46 ++++++++++++++++++++++++++++++++++ flake.nix | 1 - 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..67434c7 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,46 @@ +name: Release +on: + release: + types: [created] + +jobs: + compile: + name: Compile + runs-on: ubuntu-22.04 + + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-musl + path: target/x86_64-unknown-linux-musl/release/openheimer + + - target: x86_64-pc-windows-gnu + path: target/x86_64-pc-windows-gnu/release/openheimer.exe + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v2 + + - name: Fetch dependencies + run: lib/fetch.sh + + - name: Compile for ${{ matrix.target }} + run: nix develop -c cargo b -r --target ${{ matrix.target }} + + - name: Upload build artifacts + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.path }} + asset_name: agent-${{ matrix.target }} + tag: ${{ github.ref }} diff --git a/flake.nix b/flake.nix index 8bbeac0..2536937 100644 --- a/flake.nix +++ b/flake.nix @@ -32,7 +32,6 @@ targets = [ "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-musl" - "i686-unknown-linux-musl" "x86_64-pc-windows-gnu" ]; extensions = [ From eaceaf3f12f1eb835aa3069181790ac1b9423362 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 02:14:53 +0800 Subject: [PATCH 116/132] ci: release workflow overhaul --- .github/workflows/release.yaml | 10 +++++----- flake.nix | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 67434c7..2758e67 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,12 +12,12 @@ jobs: fail-fast: false matrix: include: - - target: x86_64-unknown-linux-musl - path: target/x86_64-unknown-linux-musl/release/openheimer - - target: x86_64-pc-windows-gnu path: target/x86_64-pc-windows-gnu/release/openheimer.exe + - target: x86_64-unknown-linux-musl + path: target/x86_64-unknown-linux-musl/release/openheimer + steps: - name: Clone repository uses: actions/checkout@v4 @@ -41,6 +41,6 @@ jobs: uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: ${{ matrix.path }} - asset_name: agent-${{ matrix.target }} tag: ${{ github.ref }} + file: ${{ matrix.path }} + asset_name: openheimer_${{ matrix.target }} diff --git a/flake.nix b/flake.nix index 2536937..05ac50c 100644 --- a/flake.nix +++ b/flake.nix @@ -30,9 +30,9 @@ rust = pkgs.rust-bin.nightly.latest.default.override { targets = [ + "x86_64-pc-windows-gnu" "x86_64-unknown-linux-gnu" "x86_64-unknown-linux-musl" - "x86_64-pc-windows-gnu" ]; extensions = [ "rust-src" From 2b828d8af1ef911f5c5cb89b51dbf62d312ebd4c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 02:34:37 +0800 Subject: [PATCH 117/132] ci: improve support --- .github/workflows/build.yaml | 15 ++++++++++++++- .github/workflows/release.yaml | 4 +++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a9a4960..b9a9593 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -14,15 +14,28 @@ jobs: name: openheimer runs-on: ubuntu-22.04 + strategy: + fail-fast: false + matrix: + include: + - system: x86_64-linux + - system: aarch64-linux + steps: - name: Clone repository uses: actions/checkout@v4 + - name: Install QEMU + run: | + sudo apt update -y + sudo apt install -y qemu-user-static + - name: Install Nix uses: DeterminateSystems/nix-installer-action@v9 with: extra-conf: | log-lines = 500 + system = ${{ matrix.system }} - name: Set up Cachix uses: cachix/cachix-action@v13 @@ -30,5 +43,5 @@ jobs: name: errornobinaries authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - name: Build default package + - name: Build for ${{ matrix.system }} run: nix build -L diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 2758e67..020e069 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -14,9 +14,11 @@ jobs: include: - target: x86_64-pc-windows-gnu path: target/x86_64-pc-windows-gnu/release/openheimer.exe + extension: .exe - target: x86_64-unknown-linux-musl path: target/x86_64-unknown-linux-musl/release/openheimer + extension: "" steps: - name: Clone repository @@ -43,4 +45,4 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ github.ref }} file: ${{ matrix.path }} - asset_name: openheimer_${{ matrix.target }} + asset_name: openheimer_${{ matrix.target }}${{ matrix.extension }} From 8faf501fee2780060edaf118de603dcb2bd50ebd Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 02:47:36 +0800 Subject: [PATCH 118/132] chore(flake): drop macOS --- flake.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 05ac50c..7acddf0 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,10 @@ extra-trusted-public-keys = ["errornobinaries.cachix.org-1:84oagGNCIsXxBTYmfTiP+lvWje7lIS294iqAtCpFsbU="]; }; - systems = ["x86_64-linux" "aarch64-linux" "aarch64-darwin"]; + systems = [ + "aarch64-linux" + "x86_64-linux" + ]; perSystem = { system, pkgs, From 296a4bbdff385b577b4ef286481458db2cabc6b1 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 12:14:17 +0800 Subject: [PATCH 119/132] ci: fix dependabot --- .github/dependabot.yml | 11 ++++++++--- .github/workflows/check.yaml | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5a5dddb..33aba8a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,12 @@ version: 2 updates: - - package-ecosystem: cargo - directory: /oppnamastaren + - package-ecosystem: "cargo" + directory: "/" schedule: - interval: daily + interval: "daily" + + - package-ecosystem: "github-actions" + directory: ".github/workflows" + schedule: + interval: "daily" diff --git a/.github/workflows/check.yaml b/.github/workflows/check.yaml index c81eed5..6e0bdc9 100644 --- a/.github/workflows/check.yaml +++ b/.github/workflows/check.yaml @@ -39,7 +39,7 @@ jobs: key: build-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('flake.nix') }}-${{ hashFiles('**.lock') }} - name: Run cargo test - run: nix develop -c cargo test + run: nix develop -c cargo t -v nix-flake: name: Nix flake From 4389b275891fbf8589ce77f0cecc0fdb44ea200a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 19:32:08 +0800 Subject: [PATCH 120/132] tweak: options -> fields --- src/arguments.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arguments.rs b/src/arguments.rs index 56a0078..b572b2f 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -36,7 +36,7 @@ pub enum ConfigurationSubcommand { /// Generate a default configuration file Default, - /// Add missing options to your existing configuration file + /// Add missing fields to your existing configuration file Fill, /// Check the validity of an existing configuration file From 92b350e55f49a02488f993b18e77023545960ca3 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Tue, 30 Jan 2024 23:08:50 +0800 Subject: [PATCH 121/132] tweak: configuration help text --- src/arguments.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arguments.rs b/src/arguments.rs index b572b2f..cd49eeb 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -33,10 +33,10 @@ pub enum MainSubcommand { #[derive(Debug, Subcommand)] pub enum ConfigurationSubcommand { - /// Generate a default configuration file + /// Generate a new configuration file template Default, - /// Add missing fields to your existing configuration file + /// Add missing fields to an existing configuration file Fill, /// Check the validity of an existing configuration file From 1a54c664d0feebe57691f0ea52a62b505fdf7d63 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Thu, 1 Feb 2024 13:57:18 +0800 Subject: [PATCH 122/132] feat(arguments): subcommand aliases --- src/arguments.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/arguments.rs b/src/arguments.rs index cd49eeb..456b0e8 100644 --- a/src/arguments.rs +++ b/src/arguments.rs @@ -22,9 +22,11 @@ pub struct Arguments { #[derive(Debug, Subcommand)] pub enum MainSubcommand { + #[command(visible_aliases = ["s"])] Start, /// Manipulate openheimer configuration files + #[command(visible_aliases = ["c", "config"])] Configuration { #[command(subcommand)] subcommand: ConfigurationSubcommand, @@ -34,11 +36,14 @@ pub enum MainSubcommand { #[derive(Debug, Subcommand)] pub enum ConfigurationSubcommand { /// Generate a new configuration file template + #[command(visible_aliases = ["d", "def", "new"])] Default, /// Add missing fields to an existing configuration file + #[command(visible_aliases = ["f", "merge"])] Fill, /// Check the validity of an existing configuration file + #[command(visible_aliases = ["v", "val", "check"])] Validate, } From d02d69eeec4e44451e44143ce39afbf4bfa2513c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 2 Feb 2024 01:37:49 +0800 Subject: [PATCH 123/132] build: replace with true --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 15ddb90..16fbfa3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +13,8 @@ built = { version = "0.7", features = ["git2"] } codegen-units = 1 lto = true panic = "abort" -strip = "symbols" -trim-paths = "all" +strip = true +trim-paths = true [dependencies] async-trait = "0.1" From 87696eeb8f9e6b6ab92c690acf81689a8497559e Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 9 Feb 2024 16:52:52 +0800 Subject: [PATCH 124/132] ci: lint Cargo.toml --- .github/workflows/lint.yaml | 41 +++++++++++++++++++++++++++++-------- flake.nix | 1 + 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index c999cf6..b25fb19 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -5,12 +5,13 @@ on: - '**.nix' - '**.rs' - Cargo.* + - flake.lock pull_request: workflow_dispatch: jobs: - rust-code: - name: Rust code + cargo-toml: + name: Cargo.toml runs-on: ubuntu-22.04 steps: @@ -24,7 +25,31 @@ jobs: log-lines = 500 - name: Set up Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v2 + uses: DeterminateSystems/magic-nix-cache-action@v3 + + - name: Run taplo lint + run: nix develop -c taplo lint Cargo.toml + + - name: Run taplo fmt + if: always() + run: nix develop -c taplo fmt --check Cargo.toml + + rust: + name: Rust + runs-on: ubuntu-22.04 + + steps: + - name: Clone repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v9 + with: + extra-conf: | + log-lines = 500 + + - name: Set up Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v3 - name: Set up build cache uses: actions/cache@v4 @@ -37,15 +62,15 @@ jobs: target/ key: build-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ hashFiles('flake.nix') }}-${{ hashFiles('**.lock') }} - - name: Run cargo clippy + - name: cargo clippy run: nix develop -c cargo clippy -- -Dwarnings -Wclippy::pedantic - - name: Run cargo fmt + - name: cargo fmt if: always() run: nix develop -c cargo fmt --check - nix-flake: - name: Nix flake + nix: + name: Nix runs-on: ubuntu-22.04 steps: @@ -59,7 +84,7 @@ jobs: log-lines = 500 - name: Set up Magic Nix Cache - uses: DeterminateSystems/magic-nix-cache-action@v2 + uses: DeterminateSystems/magic-nix-cache-action@v3 - name: Check formatting run: nix run nixpkgs#alejandra -- -c . diff --git a/flake.nix b/flake.nix index 7acddf0..c885719 100644 --- a/flake.nix +++ b/flake.nix @@ -58,6 +58,7 @@ mold pkgsCross.mingwW64.buildPackages.gcc rust + taplo unzip ]; From abf39c6ff9e9814722df7611020b546ab6c6189c Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 9 Feb 2024 23:03:40 +0800 Subject: [PATCH 125/132] chore(deps): loosen version requirements --- Cargo.toml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 16fbfa3..45c88b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,13 +19,13 @@ trim-paths = true [dependencies] async-trait = "0.1" chrono = "0.4" -clap = { version = "4.4", features = ["derive", "string"] } -colored = "2.1" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" +clap = { version = "4", features = ["derive", "string"] } +colored = "2" +serde = { version = "1", features = ["derive"] } +serde_json = "1" sqlx = { version = "0.7", features = ["sqlite", "runtime-tokio-rustls"] } tokio = { version = "1", features = ["full"] } toml = "0.8" tracing = "0.1" -tracing-appender = "0.2.3" +tracing-appender = "0.2" tracing-subscriber = { version = "0.3", features = ["time"] } From 158b00f32accec4c3eda0d7877dfa35352ace72f Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Fri, 9 Feb 2024 23:04:02 +0800 Subject: [PATCH 126/132] chore(deps): update everything --- Cargo.lock | 146 ++++++++++++++++++++++++++++------------------------- 1 file changed, 76 insertions(+), 70 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a96015e..30771eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,9 +67,9 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" @@ -245,9 +245,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" dependencies = [ "clap_builder", "clap_derive", @@ -255,9 +255,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" dependencies = [ "anstream", "anstyle", @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.4.7" +version = "4.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" +checksum = "307bc0538d5f0f83b8248db3087aa92fe504e4691294d0c96c0eabc33f47ba47" dependencies = [ "heck", "proc-macro2", @@ -279,9 +279,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "colorchoice" @@ -582,9 +582,9 @@ checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git2" -version = "0.18.1" +version = "0.18.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf97ba92db08df386e10c8ede66a2a0369bd277090afd8710e19e38de9ec0cd" +checksum = "1b3ba52851e73b46a4c3df1d89343741112003f0f6f13beb0dfac9e457c3fdcd" dependencies = [ "bitflags 2.4.2", "libc", @@ -623,9 +623,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -662,9 +662,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -695,9 +695,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "433de089bd45971eecf4668ee0ee8f4cec17db4f8bd8f7bc3197a6ce37aa7d9b" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" dependencies = [ "equivalent", "hashbrown", @@ -705,9 +705,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" dependencies = [ "either", ] @@ -720,18 +720,18 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" +checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" dependencies = [ "libc", ] [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -747,15 +747,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.152" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libgit2-sys" -version = "0.16.1+1.7.1" +version = "0.16.2+1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2a2bb3680b094add03bb3732ec520ece34da31a8cd2d633d1389d0f0fb60d0c" +checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" dependencies = [ "cc", "libc", @@ -838,9 +838,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -904,21 +904,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" dependencies = [ "autocfg", "num-integer", @@ -927,9 +932,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", "libm", @@ -1179,9 +1184,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.30" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ "bitflags 2.4.2", "errno", @@ -1605,9 +1610,9 @@ dependencies = [ [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" [[package]] name = "subtle" @@ -1639,13 +1644,12 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.9.0" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", "rustix", "windows-sys 0.52.0", ] @@ -1682,12 +1686,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.31" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -1702,10 +1707,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -1726,9 +1732,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -1767,9 +1773,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" +checksum = "9a9aad4a3066010876e8dcf5a8a06e70a558751117a145c6ce2b82c2e2054290" dependencies = [ "serde", "serde_spanned", @@ -1788,9 +1794,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "0c9ffdf896f8daaabf9b66ba8e77ea1ed5ed0f72821b398aba62352e95062951" dependencies = [ "indexmap", "serde", @@ -1899,9 +1905,9 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode_categories" @@ -1964,9 +1970,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1974,9 +1980,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", @@ -1989,9 +1995,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1999,9 +2005,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", @@ -2012,15 +2018,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "webpki-roots" -version = "0.25.3" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1778a42e8b3b90bff8d0f5032bf22250792889a5cdc752aa0020c84abe3aaf10" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "whoami" @@ -2193,9 +2199,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.35" +version = "0.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1931d78a9c73861da0134f453bb1f790ce49b2e30eba8410b4b79bac72b46a2d" +checksum = "5389a154b01683d28c77f8f68f49dea75f0a4da32557a58f68ee51ebba472d29" dependencies = [ "memchr", ] From e668264afd37ebd5d41dd7ee9b9b0b96c8d9f884 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sat, 10 Feb 2024 00:59:30 +0800 Subject: [PATCH 127/132] chore(nix): fix nixConfig --- flake.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/flake.nix b/flake.nix index c885719..b104e51 100644 --- a/flake.nix +++ b/flake.nix @@ -14,11 +14,6 @@ ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { - flake.nixConfig = { - extra-substituters = ["https://errornobinaries.cachix.org/"]; - extra-trusted-public-keys = ["errornobinaries.cachix.org-1:84oagGNCIsXxBTYmfTiP+lvWje7lIS294iqAtCpFsbU="]; - }; - systems = [ "aarch64-linux" "x86_64-linux" @@ -89,4 +84,9 @@ packages.default = packages.openheimer; }; }; + + nixConfig = { + extra-substituters = ["https://errornobinaries.cachix.org/"]; + extra-trusted-public-keys = ["errornobinaries.cachix.org-1:84oagGNCIsXxBTYmfTiP+lvWje7lIS294iqAtCpFsbU="]; + }; } From 07055f74e112c1202e973474c5a98586488519f5 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 12 Feb 2024 17:33:32 +0800 Subject: [PATCH 128/132] chore(nix): update inputs --- flake.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index c2f944f..94f4567 100644 --- a/flake.lock +++ b/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1704982712, - "narHash": "sha256-2Ptt+9h8dczgle2Oo6z5ni5rt/uLMG47UFTR1ry/wgg=", + "lastModified": 1706830856, + "narHash": "sha256-a0NYyp+h9hlb7ddVz4LUn1vT/PLwqfrWYcHMvFB1xYg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "07f6395285469419cf9d078f59b5b49993198c00", + "rev": "b253292d9c0a5ead9bc98c4e9a26c6312e27d69f", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -38,11 +38,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1706191920, - "narHash": "sha256-eLihrZAPZX0R6RyM5fYAWeKVNuQPYjAkCUBr+JNvtdE=", + "lastModified": 1707546158, + "narHash": "sha256-nYYJTpzfPMDxI8mzhQsYjIUX+grorqjKEU9Np6Xwy/0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ae5c332cbb5827f6b1f02572496b141021de335f", + "rev": "d934204a0f8d9198e1e4515dd6fec76a139c87f0", "type": "github" }, "original": { @@ -55,11 +55,11 @@ "nixpkgs-lib": { "locked": { "dir": "lib", - "lastModified": 1703961334, - "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", + "lastModified": 1706550542, + "narHash": "sha256-UcsnCG6wx++23yeER4Hg18CXWbgNpqNXcHIo5/1Y+hc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", + "rev": "97b17f32362e475016f942bbdfda4a4a72a8a652", "type": "github" }, "original": { @@ -72,11 +72,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1681358109, - "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=", + "lastModified": 1706487304, + "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9", + "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", "type": "github" }, "original": { @@ -99,11 +99,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1703384182, - "narHash": "sha256-g5K8bFBCIQ3x/j/MFTpkZo4It5SGWPwhBp/lASiy+pA=", + "lastModified": 1707703915, + "narHash": "sha256-Vej69igzNr3eVDca6+32uO+TXjVWx6ZUwwy3iZuzhJ4=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "cb6395cb3c2f69ad028914c90bce833e51d339c9", + "rev": "e6679d2ff9136d00b3a7168d2bf1dff9e84c5758", "type": "github" }, "original": { From a4233a0d91d492ad89e43fc4e0673e70577470c2 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 12 Feb 2024 18:05:18 +0800 Subject: [PATCH 129/132] chore(deps): update everything --- Cargo.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 30771eb..12df34a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "ahash" -version = "0.8.7" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" dependencies = [ "cfg-if", "getrandom", @@ -231,9 +231,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", @@ -409,9 +409,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" dependencies = [ "serde", ] @@ -695,9 +695,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown", @@ -1656,18 +1656,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", From d18685a09513f51a3a12adbc1a602813da6918de Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Mon, 12 Feb 2024 18:21:35 +0800 Subject: [PATCH 130/132] refactor: oxidize --- src/arguments/configuration.rs | 4 ++-- src/configuration.rs | 12 ++++++++---- src/database/mod.rs | 5 +++++ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/arguments/configuration.rs b/src/arguments/configuration.rs index e821729..631a24f 100644 --- a/src/arguments/configuration.rs +++ b/src/arguments/configuration.rs @@ -11,7 +11,7 @@ pub fn parse(arguments: &Arguments, subcommand: &ConfigurationSubcommand) { } fn default() { - println!("{}", Configuration::default().to_string()); + println!("{}", Configuration::default()); } fn fill(arguments: &Arguments) { @@ -33,7 +33,7 @@ fn fill(arguments: &Arguments) { } }; - println!("{}", options.to_string()); + println!("{options}"); } fn validate(arguments: &Arguments) { diff --git a/src/configuration.rs b/src/configuration.rs index 7e0ec85..1b9f199 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,5 +1,5 @@ use serde::{Deserialize, Serialize}; -use std::str::FromStr; +use std::{fmt, str::FromStr}; use tracing_appender::rolling; #[derive(Debug)] @@ -83,8 +83,12 @@ impl FromStr for Configuration { } } -impl ToString for Configuration { - fn to_string(&self) -> String { - toml::to_string_pretty(&self).unwrap().trim().to_string() +impl fmt::Display for Configuration { + fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + write!( + formatter, + "{}", + toml::to_string_pretty(&self).unwrap().trim() + ) } } diff --git a/src/database/mod.rs b/src/database/mod.rs index 6e32aac..303c96c 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -12,19 +12,24 @@ pub enum Error { #[async_trait] pub trait Database { + #[allow(dead_code)] async fn new(location: String) -> Result where Self: Sized; + #[allow(dead_code)] async fn add_server(&mut self, server: &minecraft::server::Server) -> Result<(), Error>; + #[allow(dead_code)] async fn add_player(&mut self, player: &minecraft::player::Player) -> Result<(), Error>; + #[allow(dead_code)] async fn add_targeted_server( &mut self, server: &minecraft::server::Server, ) -> Result<(), Error>; + #[allow(dead_code)] async fn add_targeted_player( &mut self, player: &minecraft::player::Player, From 48fea95224fff52af9e1455d01129a672e672b7a Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sat, 24 Feb 2024 02:10:43 +0800 Subject: [PATCH 131/132] chore(nix): use shortRev for version --- flake.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index b104e51..964af65 100644 --- a/flake.nix +++ b/flake.nix @@ -8,9 +8,10 @@ }; outputs = { - nixpkgs, flake-parts, + nixpkgs, rust-overlay, + self, ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { @@ -69,7 +70,10 @@ packages.openheimer = pkgs.rustPlatform.buildRustPackage { pname = "openheimer"; - version = "dev"; + version = + if (self ? shortRev) + then self.shortRev + else self.dirtyShortRev; cargoLock.lockFile = ./Cargo.lock; src = pkgs.lib.cleanSource ./.; From 8eb17804b537c379b831619741507ffd5c838fb8 Mon Sep 17 00:00:00 2001 From: ErrorNoInternet Date: Sun, 19 May 2024 03:14:33 +0800 Subject: [PATCH 132/132] refactor(nix): clean up flake --- flake.nix | 41 +++++++++++++++++------------------------ 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/flake.nix b/flake.nix index 964af65..7909213 100644 --- a/flake.nix +++ b/flake.nix @@ -19,26 +19,20 @@ "aarch64-linux" "x86_64-linux" ]; + perSystem = { system, pkgs, ... }: let - inherit (pkgs) pkgsStatic; - inherit (pkgs) pkgsCross; - + inherit (pkgs) pkgsCross pkgsStatic; rust = pkgs.rust-bin.nightly.latest.default.override { - targets = [ - "x86_64-pc-windows-gnu" - "x86_64-unknown-linux-gnu" - "x86_64-unknown-linux-musl" - ]; extensions = [ "rust-src" "rust-analyzer-preview" ]; }; - in rec { + in { _module.args.pkgs = import nixpkgs { inherit system; overlays = [rust-overlay.overlays.default]; @@ -68,24 +62,23 @@ RUST_BACKTRACE = 1; }; - packages.openheimer = pkgs.rustPlatform.buildRustPackage { - pname = "openheimer"; - version = - if (self ? shortRev) - then self.shortRev - else self.dirtyShortRev; + packages = rec { + openheimer = pkgs.rustPlatform.buildRustPackage { + pname = "openheimer"; + version = self.shortRev or self.dirtyShortRev; - cargoLock.lockFile = ./Cargo.lock; - src = pkgs.lib.cleanSource ./.; + src = pkgs.lib.cleanSource ./.; + cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = with pkgs; [ - clang - libgit2 - mold - rust - ]; + nativeBuildInputs = with pkgs; [ + clang + libgit2 + mold + rust + ]; + }; + default = openheimer; }; - packages.default = packages.openheimer; }; };