Commit e2a129e
Add DHT mode and cleanup interval configuration (#8)
* Added option to set DHT to client mode only and configure the cleanup interval
* test(dht): standardize struct field alignment in configuration tests
* Refactor DHT configuration tests to eliminate code duplication
- Extract common test setup into createTestClient helper function
- Consolidate overlapping tests (TestDHTModeDefault, TestDHTModeServer, TestDHTModeClient) into TestDHTModeSelection
- Merge TestDHTModeServerWithVariousCleanupIntervals into TestDHTCleanupIntervalConfiguration
- Reduce test count from 11 to 5 while maintaining full coverage
- Use t.Helper() and t.Cleanup() for better test organization
- Add descriptive assertion messages for clearer failures
- Improve benchmark error handling
Changes:
- Lines of code reduced: 416 -> 312 (25% reduction)
- Tests consolidated: 11 -> 5 (same coverage, better organization)
- Code duplication eliminated: 9 repeated log setups, 11 repeated client creations now use 1 helper
- All tests still pass with identical coverage
* refactor(tests): improve client closure handling in DHT tests
* refactor(types): clarify P2PClient alias for backward compatibility
* refactor(tests): handle client closure errors in DHT tests
* refactor(tests): replace hardcoded log messages with constants
* chore(deps): update dependabot configuration for Go modules
Added Go modules configuration for the /example/ directory to ensure
weekly updates for direct dependencies, including security patterns
and commit message prefixing.
* chore(deps): update module versions in go.mod and go.sum
Updated dependencies to their latest versions for improved stability and performance.
* chore(deps): update indirect dependencies in go.mod and go.sum
---------
Co-authored-by: Mr. Z <mrz1836@users.noreply.github.com>1 parent d7ceda3 commit e2a129e
File tree
9 files changed
+474
-62
lines changed- .github
- example
9 files changed
+474
-62
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
60 | 89 | | |
61 | 90 | | |
62 | 91 | | |
| |||
79 | 108 | | |
80 | 109 | | |
81 | 110 | | |
82 | | - | |
| 111 | + | |
83 | 112 | | |
84 | 113 | | |
85 | 114 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
30 | 34 | | |
31 | 35 | | |
32 | 36 | | |
| |||
92 | 96 | | |
93 | 97 | | |
94 | 98 | | |
95 | | - | |
| 99 | + | |
96 | 100 | | |
97 | 101 | | |
98 | 102 | | |
| |||
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
207 | | - | |
208 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
209 | 251 | | |
210 | 252 | | |
211 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
82 | 100 | | |
0 commit comments