diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7a4a3ea --- /dev/null +++ b/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/README.md b/README.md index 436aa4c..f2d7472 100644 --- a/README.md +++ b/README.md @@ -31,11 +31,11 @@ Data will be inserted in the mongodb `hagelslag` database inside the `` ```json { // ip address - _id: "", + "_id": "", // time in milliseconds - latency: - // html response (headers and body) or json - data: + "latency": 0, + // data can be a string or json + "data": "" } ``` @@ -47,8 +47,6 @@ go install github.com/Kyagara/hagelslag-go@latest ## Ideas -- Use zerolog instead of fmt. - - The amount of workers/tasks running might not be good, find a better default based on some values. - Add more checks for response size, also make a better read function for HTTP, currently it reads until EOF, maybe add a limit. diff --git a/go.mod b/go.mod index 46a4334..39725a0 100644 --- a/go.mod +++ b/go.mod @@ -2,11 +2,16 @@ module github.com/Kyagara/hagelslag go 1.23 -require go.mongodb.org/mongo-driver v1.17.1 +require ( + github.com/rs/zerolog v1.33.0 + go.mongodb.org/mongo-driver v1.17.1 +) require ( github.com/golang/snappy v0.0.4 // indirect github.com/klauspost/compress v1.13.6 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/montanaflynn/stats v0.7.1 // indirect github.com/xdg-go/pbkdf2 v1.0.0 // indirect github.com/xdg-go/scram v1.1.2 // indirect @@ -14,5 +19,6 @@ require ( github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect golang.org/x/crypto v0.26.0 // indirect golang.org/x/sync v0.8.0 // indirect + golang.org/x/sys v0.26.0 // indirect golang.org/x/text v0.17.0 // indirect ) diff --git a/go.sum b/go.sum index 6914e50..6768fbb 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,25 @@ +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8eaE= github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= github.com/xdg-go/scram v1.1.2 h1:FHX5I5B4i4hKRVRBCFRxq1iQRej7WO3hhBuJf+UUySY= @@ -36,6 +48,11 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo= +golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/ip.go b/ip.go index 5c4e69a..c1f6b74 100644 --- a/ip.go +++ b/ip.go @@ -7,7 +7,7 @@ import ( ) // Parse an IP string into its segments. -func parseIP(ip string, seg_a *uint8, seg_b *uint8, seg_c *uint8, seg_d *uint8) error { +func parseIP(ip string, segA *uint8, segB *uint8, segC *uint8, segD *uint8) error { octets := strings.Split(ip, ".") if len(octets) != 4 { return fmt.Errorf("invalid IP address '%s'", ip) @@ -33,41 +33,41 @@ func parseIP(ip string, seg_a *uint8, seg_b *uint8, seg_c *uint8, seg_d *uint8) return fmt.Errorf("invalid IP address '%s', %s", ip, err) } - *seg_a = uint8(newSegA) - *seg_b = uint8(newSegB) - *seg_c = uint8(newSegC) - *seg_d = uint8(newSegD) + *segA = uint8(newSegA) + *segB = uint8(newSegB) + *segC = uint8(newSegC) + *segD = uint8(newSegD) return nil } // Check if the IP is in any reserved range, skips to the next available range if it is. -func isReserved(seg_a *uint8, seg_b *uint8, seg_c *uint8) bool { +func isReserved(segA *uint8, segB *uint8, segC *uint8) bool { // 10.x.x.x // 127.x.x.x - if *seg_a == 10 || *seg_a == 127 { - *seg_a = *seg_a + 1 + if *segA == 10 || *segA == 127 { + *segA++ return true } // 169.254.x.x - if *seg_a == 169 && *seg_b == 254 { - *seg_b = 255 + if *segA == 169 && *segB == 254 { + *segB = 255 return true } // 172.(>= 16 && <= 31).x.x - if *seg_a == 172 && *seg_b >= 16 && *seg_b <= 31 { - *seg_b = 32 + if *segA == 172 && *segB >= 16 && *segB <= 31 { + *segB = 32 return true } - if *seg_a == 192 { - if *seg_b == 0 { + if *segA == 192 { + if *segB == 0 { // 192.0.0.x // 192.0.2.x - if *seg_c == 0 || *seg_c == 2 { - *seg_c = *seg_c + 1 + if *segC == 0 || *segC == 2 { + *segC++ return true } @@ -75,14 +75,14 @@ func isReserved(seg_a *uint8, seg_b *uint8, seg_c *uint8) bool { } // 192.88.99.0 - if *seg_b == 88 && *seg_c == 99 { - *seg_c = 100 + if *segB == 88 && *segC == 99 { + *segC = 100 return true } // 192.168.x.x - if *seg_b == 168 { - *seg_b = 169 + if *segB == 168 { + *segB = 169 return true } @@ -90,14 +90,14 @@ func isReserved(seg_a *uint8, seg_b *uint8, seg_c *uint8) bool { } // 198.51.100.x - if *seg_a == 198 && *seg_b == 51 && *seg_c == 100 { - *seg_c = 101 + if *segA == 198 && *segB == 51 && *segC == 100 { + *segC = 101 return true } // 203.0.113.x - if *seg_a == 203 && *seg_b == 0 && *seg_c == 113 { - *seg_c = 114 + if *segA == 203 && *segB == 0 && *segC == 113 { + *segC = 114 return true } diff --git a/main.go b/main.go index 3932de9..0dae939 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,8 @@ import ( "syscall" "time" + "github.com/rs/zerolog" + "github.com/rs/zerolog/log" "go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo/options" ) @@ -30,9 +32,9 @@ type Scanner interface { // 'tcp' or 'udp' Network() string // Scans and returns the response and latency - Scan(string, net.Conn) ([]byte, int64, error) + Scan(ip string, conn net.Conn) ([]byte, int64, error) // Saves the response to the database - Save(string, int64, []byte, *mongo.Collection) error + Save(ip string, latency int64, data []byte, collection *mongo.Collection) error } func main() { @@ -42,6 +44,8 @@ func main() { tasksPerThread := flag.Int("tasks", 512, "Tasks per thread (default: 512)") flag.Parse() + zerolog.TimeFieldFormat = zerolog.TimeFormatUnix + var scanner Scanner switch *scannerName { case "http": @@ -59,16 +63,16 @@ func main() { ips := make(chan string, maxTasks) var wg sync.WaitGroup - for i := 0; i < *numWorkers; i++ { + for range *numWorkers { wg.Add(1) go worker(scanner, *tasksPerThread, ips, &wg) } - var seg_a, seg_b, seg_c, seg_d uint8 + var segA, segB, segC, segD uint8 if *ip != "" { fmt.Printf("Starting from IP '%s'\n", *ip) - err := parseIP(*ip, &seg_a, &seg_b, &seg_c, &seg_d) + err := parseIP(*ip, &segA, &segB, &segC, &segD) if err != nil { fmt.Println(err) os.Exit(1) @@ -85,31 +89,30 @@ func main() { fmt.Println("Received signal, shutting down...") close(ips) wg.Wait() - fmt.Printf("Last IP: %d.%d.%d.%d\n", seg_a, seg_b, seg_c, seg_d) + fmt.Printf("Last IP: %d.%d.%d.%d\n", segA, segB, segC, segD) fmt.Printf("Done.\n") return default: - if isReserved(&seg_a, &seg_b, &seg_c) { - fmt.Println("Reserved range reached, skipping to next available range") + ip := fmt.Sprintf("%d.%d.%d.%d", segA, segB, segC, segD) + + if isReserved(&segA, &segB, &segC) { + log.Log().Str("ip", ip).Msg("Reserved range reached, skipping to next available range") } - ips <- fmt.Sprintf("%d.%d.%d.%d", seg_a, seg_b, seg_c, seg_d) + ips <- ip - seg_d++ - if seg_d == 0 { - seg_d = 0 - seg_c++ + segD++ + if segD == 0 { + segC++ - if seg_c == 0 { - seg_c = 0 - seg_b++ + if segC == 0 { + segB++ - if seg_b == 0 { - seg_b = 0 - seg_a++ + if segB == 0 { + segA++ - if seg_a >= 224 { + if segA >= 224 { signals <- syscall.SIGTERM return } @@ -125,14 +128,14 @@ func worker(scanner Scanner, tasksPerThread int, ips <-chan string, wg *sync.Wai client, err := mongo.Connect(context.TODO(), options.Client().ApplyURI("mongodb://localhost:27017")) if err != nil { - fmt.Println(err) + fmt.Printf("Error connecting to database: %s\n", err) return } defer func() { err := client.Disconnect(context.TODO()) if err != nil { - fmt.Println(err) + fmt.Printf("Error disconnecting from database: %s\n", err) } }() @@ -157,7 +160,6 @@ func worker(scanner Scanner, tasksPerThread int, ips <-chan string, wg *sync.Wai conn, err := dialer.Dial(network, address) if err != nil { if errors.Is(err, os.ErrDeadlineExceeded) { - fmt.Printf("TIMEOUT %s\n", ip) return } @@ -169,10 +171,11 @@ func worker(scanner Scanner, tasksPerThread int, ips <-chan string, wg *sync.Wai // Read and Write deadline err = conn.SetDeadline(time.Now().Add(3 * time.Second)) if err != nil { - fmt.Printf("TIMEOUT %s\n", ip) return } + log.Log().Str("ip", ip).Msg("CONNECTED") + response, latency, err := scanner.Scan(ip, conn) if len(response) == 0 && err == nil { // No response, or wrong response (not wanted, can be discarded) @@ -185,17 +188,17 @@ func worker(scanner Scanner, tasksPerThread int, ips <-chan string, wg *sync.Wai return } - fmt.Printf("ERROR %s | %s\n", ip, err) + log.Log().Str("ip", ip).Err(err).Msg("SCAN") return } err = scanner.Save(ip, latency, response, collection) if err != nil { - fmt.Printf("ERROR %s | error inserting to document: %s\n", ip, err) + log.Log().Str("ip", ip).Err(err).Msg("SAVE") return } - fmt.Printf("SUCCESS %s\n", ip) + log.Log().Str("ip", ip).Msg("SAVED") }(ip) } } diff --git a/veloren.go b/veloren.go index e4ec930..6352df6 100644 --- a/veloren.go +++ b/veloren.go @@ -52,7 +52,7 @@ func (s VelorenScanner) Scan(ip string, conn net.Conn) ([]byte, int64, error) { p := binary.LittleEndian.Uint64(response[4:12]) // version, not used for now - //v := binary.BigEndian.Uint16(response[12:]) + // v := binary.BigEndian.Uint16(response[12:]) // Set 'P' from response to the request binary.LittleEndian.PutUint64(request[2:12], p)