Skip to content

Commit

Permalink
switch to go 1.23
Browse files Browse the repository at this point in the history
refactoring
add context passing everywhere
add new caching logic
  • Loading branch information
vintikzzz committed Nov 4, 2024
1 parent 6669290 commit e515b8b
Show file tree
Hide file tree
Showing 19 changed files with 824 additions and 1,161 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ tmp

.DS_Store
__debug_bin
rest-api
rest-api
.env
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,11 @@ OPTIONS:
--torrent-store-port value torrent store port (default: 50051) [$TORRENT_STORE_SERVICE_PORT, $ TORRENT_STORE_PORT]
--magnet2torrent-host value magnet2torrent host [$MAGNET2TORRENT_SERVICE_HOST, $ MAGNET2TORRENT_HOST]
--magnet2torrent-port value magnet2torrent port (default: 50051) [$MAGNET2TORRENT_SERVICE_PORT, $ MAGNET2TORRENT_PORT]
--torrent-web-cache-host value torrent web cache host [$TORRENT_WEB_CACHE_SERVICE_HOST, $ TORRENT_WEB_CACHE_HOST]
--torrent-web-cache-port value torrent web cache port (default: 80) [$TORRENT_WEB_CACHE_SERVICE_PORT, $ TORRENT_WEB_CACHE_SERVICE_PORT]
--export-domain value export domain [$EXPORT_DOMAIN]
--export-ssl export ssl [$EXPORT_SSL]
--node-label-prefix value node label prefix (default: "webtor.io/") [$NODE_LABEL_PREFIX]
--node-iface value node iface (default: "eth0") [$NODE_IFACE]
--prom-addr value prometheus connection address [$PROM_ADDR]
--transcode-web-cache-host value transcode web cache host [$TRANSCODE_WEB_CACHE_SERVICE_HOST, $ TRANSCODE_WEB_CACHE_HOST]
--transcode-web-cache-port value transcode web cache port (default: 80) [$TRANSCODE_WEB_CACHE_SERVICE_PORT, $ TRANSCODE_WEB_CACHE_SERVICE_PORT]
```

## Swagger (OpenAPI)
Expand Down
80 changes: 71 additions & 9 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs

import "github.com/swaggo/swag"
Expand Down Expand Up @@ -352,6 +351,15 @@ const docTemplate = `{
}
}
},
"services.ExportKindType": {
"type": "string",
"enum": [
"subtitles"
],
"x-enum-varnames": [
"ExportKindTypeSubtitles"
]
},
"services.ExportMeta": {
"type": "object",
"properties": {
Expand All @@ -366,6 +374,17 @@ const docTemplate = `{
}
}
},
"services.ExportPreloadType": {
"type": "string",
"enum": [
"auto",
"none"
],
"x-enum-varnames": [
"ExportPreloadTypeAuto",
"ExportPreloadTypeNone"
]
},
"services.ExportResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -401,7 +420,7 @@ const docTemplate = `{
"type": "string"
},
"preload": {
"type": "string"
"$ref": "#/definitions/services.ExportPreloadType"
},
"sources": {
"type": "array",
Expand All @@ -413,7 +432,7 @@ const docTemplate = `{
"type": "string"
},
"tag": {
"type": "string"
"$ref": "#/definitions/services.ExportTagName"
},
"tracks": {
"type": "array",
Expand All @@ -423,11 +442,24 @@ const docTemplate = `{
}
}
},
"services.ExportTagName": {
"type": "string",
"enum": [
"video",
"audio",
"img"
],
"x-enum-varnames": [
"ExportTagNameVideo",
"ExportTagNameAudio",
"ExportTagNameImage"
]
},
"services.ExportTrack": {
"type": "object",
"properties": {
"kind": {
"type": "string"
"$ref": "#/definitions/services.ExportKindType"
},
"label": {
"type": "string"
Expand All @@ -450,7 +482,7 @@ const docTemplate = `{
"type": "string"
},
"media_format": {
"type": "string"
"$ref": "#/definitions/services.MediaFormat"
},
"mime_type": {
"type": "string"
Expand All @@ -465,7 +497,7 @@ const docTemplate = `{
"type": "integer"
},
"type": {
"type": "string"
"$ref": "#/definitions/services.ListType"
}
}
},
Expand All @@ -488,7 +520,7 @@ const docTemplate = `{
"type": "integer"
},
"media_format": {
"type": "string"
"$ref": "#/definitions/services.MediaFormat"
},
"mime_type": {
"type": "string"
Expand All @@ -503,10 +535,38 @@ const docTemplate = `{
"type": "integer"
},
"type": {
"type": "string"
"$ref": "#/definitions/services.ListType"
}
}
},
"services.ListType": {
"type": "string",
"enum": [
"file",
"directory"
],
"x-enum-varnames": [
"ListTypeFile",
"ListTypeDirectory"
]
},
"services.MediaFormat": {
"type": "string",
"enum": [
"audio",
"video",
"image",
"subtitle",
"unknown"
],
"x-enum-varnames": [
"Audio",
"Video",
"Image",
"Subtitle",
"Unknown"
]
},
"services.ResourceResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -534,6 +594,8 @@ var SwaggerInfo = &swag.Spec{
Description: "Simple API to communicate with Webtor service.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}

func init() {
Expand Down
75 changes: 68 additions & 7 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,15 @@
}
}
},
"services.ExportKindType": {
"type": "string",
"enum": [
"subtitles"
],
"x-enum-varnames": [
"ExportKindTypeSubtitles"
]
},
"services.ExportMeta": {
"type": "object",
"properties": {
Expand All @@ -357,6 +366,17 @@
}
}
},
"services.ExportPreloadType": {
"type": "string",
"enum": [
"auto",
"none"
],
"x-enum-varnames": [
"ExportPreloadTypeAuto",
"ExportPreloadTypeNone"
]
},
"services.ExportResponse": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -392,7 +412,7 @@
"type": "string"
},
"preload": {
"type": "string"
"$ref": "#/definitions/services.ExportPreloadType"
},
"sources": {
"type": "array",
Expand All @@ -404,7 +424,7 @@
"type": "string"
},
"tag": {
"type": "string"
"$ref": "#/definitions/services.ExportTagName"
},
"tracks": {
"type": "array",
Expand All @@ -414,11 +434,24 @@
}
}
},
"services.ExportTagName": {
"type": "string",
"enum": [
"video",
"audio",
"img"
],
"x-enum-varnames": [
"ExportTagNameVideo",
"ExportTagNameAudio",
"ExportTagNameImage"
]
},
"services.ExportTrack": {
"type": "object",
"properties": {
"kind": {
"type": "string"
"$ref": "#/definitions/services.ExportKindType"
},
"label": {
"type": "string"
Expand All @@ -441,7 +474,7 @@
"type": "string"
},
"media_format": {
"type": "string"
"$ref": "#/definitions/services.MediaFormat"
},
"mime_type": {
"type": "string"
Expand All @@ -456,7 +489,7 @@
"type": "integer"
},
"type": {
"type": "string"
"$ref": "#/definitions/services.ListType"
}
}
},
Expand All @@ -479,7 +512,7 @@
"type": "integer"
},
"media_format": {
"type": "string"
"$ref": "#/definitions/services.MediaFormat"
},
"mime_type": {
"type": "string"
Expand All @@ -494,10 +527,38 @@
"type": "integer"
},
"type": {
"type": "string"
"$ref": "#/definitions/services.ListType"
}
}
},
"services.ListType": {
"type": "string",
"enum": [
"file",
"directory"
],
"x-enum-varnames": [
"ListTypeFile",
"ListTypeDirectory"
]
},
"services.MediaFormat": {
"type": "string",
"enum": [
"audio",
"video",
"image",
"subtitle",
"unknown"
],
"x-enum-varnames": [
"Audio",
"Video",
"Image",
"Subtitle",
"Unknown"
]
},
"services.ResourceResponse": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit e515b8b

Please sign in to comment.