-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 48701be
Showing
10 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: test | ||
on: | ||
push: | ||
branches: | ||
# 任何分支 | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
name: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up deno | ||
uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: v1.x | ||
|
||
- name: Test | ||
run: deno task test |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"printWidth": 120, | ||
"tabWidth": 2, | ||
"tabs": false, | ||
"semi": false, | ||
"trailingComma": "none", | ||
"singleQuote": true, | ||
"quoteProps": "as-needed", | ||
"bracketSpacing": true, | ||
"arrowParens": "always", | ||
"endOfLine": "lf", | ||
"htmlWhitespaceSensitivity": "ignore" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"request": "launch", | ||
"name": "Test debug", | ||
"type": "node", | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "deno", | ||
"runtimeArgs": [ | ||
"test", | ||
"--inspect-wait", | ||
"--allow-all" | ||
], | ||
"attachSimplePort": 9229 | ||
}, | ||
{ | ||
"request": "launch", | ||
"name": "Launch Program", | ||
"type": "node", | ||
"program": "${file}", | ||
"cwd": "${workspaceFolder}", | ||
"runtimeExecutable": "deno", | ||
"runtimeArgs": [ | ||
"run" | ||
], | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"deno.enable": true, | ||
"deno.lint": true, | ||
"deno.unstable": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 deno-torrent | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# [uTP](https://deno.land/x/dt_utp) [![Custom badge](https://img.shields.io/endpoint?url=https%3A%2F%2Fdeno-visualizer.danopia.net%2Fshields%2Flatest-version%2Fx%2Fdt_utp%2Fmod.ts)](https://deno.land/x/dt_utp) | ||
|
||
μTP protocol implementation in TypeScript for Deno. This is a work in progress and not yet functional. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"imports": { | ||
"std/": "https://deno.land/[email protected]/" | ||
}, | ||
"tasks": { | ||
"test": "deno test --allow-read" | ||
}, | ||
"test": { | ||
"include": [ | ||
"./test" | ||
] | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
let BENCODE_DEBUG_ENABLE = false | ||
|
||
export function disableDebug() { | ||
BENCODE_DEBUG_ENABLE = false | ||
} | ||
|
||
export function enableDebug() { | ||
BENCODE_DEBUG_ENABLE = true | ||
} | ||
|
||
export function logd(message?: any, ...optionalParams: any[]) { | ||
if (!BENCODE_DEBUG_ENABLE) return | ||
|
||
// format current date: 2021-01-01 00:00:00 | ||
const date = new Date() | ||
const year = date.getFullYear() | ||
const month = date.getMonth() + 1 | ||
const day = date.getDate() | ||
|
||
const hour = date.getHours() | ||
const minute = date.getMinutes() | ||
const second = date.getSeconds() | ||
|
||
const time = `${year}-${month}-${day} ${hour}:${minute}:${second}` | ||
|
||
// 为time添加颜色 | ||
const formattedTime = `\x1b[36m${time}\x1b[0m` | ||
|
||
const formattedMessage = `[${formattedTime}] ${message}` | ||
|
||
console.log(formattedMessage, ...optionalParams) | ||
} |