IDM 平替 Gopeed Flutter 开源免费下载工具
视频
https://youtu.be/m206G5lVXPM
https://www.bilibili.com/video/BV1Lz421k7Zp/
前言
原文 https://ducafecat.com/blog/flutter-gopeed-downloader-idm-replace
https://flutter.ducafecat.com/github/repo/GopeedLab/gopeed
出于好奇我把站点排第一位 gopeed 的代码看了下才发现用的 getx ,所以在你质疑 getx 的时候,别人已经项目 star 13k 了。今天会来介绍下这个项目。
Gopeed,一款轻量原生的 Flutter 下载器,支持 HTTP、BitTorrent、Magnet 等协议,提供全平台高速下载体验。
本文将会讲解如何使用 gopeed, 以及项目代码分析讲解。
系统学习 flutter getx 请关注 https://ducafecat.com/course/flutter-woo。
参考
https://flutter.ducafecat.com/github/repo/GopeedLab/gopeed
https://github.com/GopeedLab/gopeed
https://github.com/search?q=topic%3Agopeed-extension&type=repositories
安装
多平台安装
https://github.com/GopeedLab/gopeed/releases/tag/v1.5.6
APP 配置
设置下载目录,并发数量
可设置代理
各种下载插件
https://github.com/search?q=topic%3Agopeed-extension&type=repositories
浏览器插件
https://chromewebstore.google.com/detail/gopeed/mijpgljlfcapndmchhjffkpckknofcnd
app 设置 API
安全起见可以设置令牌
插件添加服务器设置
设置完之后,当你页面中点击触发下载后就会启动插件,把任务提交到 gopeed。
代码编译
环境
- Golang 1.21+
- Flutter 3.16+
go server
这里我以 macos 举例
go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/macos/Frameworks/libgopeed.dylib github.com/GopeedLab/gopeed/bind/desktop
flutter ui
cd ui/flutter
flutter build macos
代码分析
gopeed go server 服务端
go 代码目录
分析包文件 go.mod
module github.com/GopeedLab/gopeedgo 1.21require (github.com/anacrolix/missinggo/v2 v2.7.3github.com/anacrolix/torrent v1.53.3github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5github.com/dop251/goja v0.0.0-20231027120936-b396bb4c349dgithub.com/dop251/goja_nodejs v0.0.0-20231122114759-e84d9a924c5cgithub.com/go-git/go-git/v5 v5.8.1github.com/gorilla/handlers v1.5.1github.com/gorilla/mux v1.8.0github.com/matoous/go-nanoid/v2 v2.0.0github.com/pkg/errors v0.9.1github.com/rs/zerolog v1.31.0github.com/virtuald/go-paniclog v0.0.0-20190812204905-43a7fa316459go.etcd.io/bbolt v1.3.8golang.org/x/exp v0.0.0-20240119083558-1b970713d09agolang.org/x/sync v0.6.0
)require (dario.cat/mergo v1.0.0 // indirectgithub.com/Microsoft/go-winio v0.6.1 // indirectgithub.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirectgithub.com/RoaringBitmap/roaring v1.7.0 // indirectgithub.com/acomagu/bufpipe v1.0.4 // indirectgithub.com/ajwerner/btree v0.0.0-20211221152037-f427b3e689c0 // indirectgithub.com/alecthomas/atomic v0.1.0-alpha2 // indirectgithub.com/anacrolix/chansync v0.4.0 // indirectgithub.com/anacrolix/dht/v2 v2.21.0 // indirectgithub.com/anacrolix/envpprof v1.3.0 // indirectgithub.com/anacrolix/generics v0.0.0-20230911070922-5dd7545c6b13 // indirectgithub.com/anacrolix/go-libutp v1.3.1 // indirectgithub.com/anacrolix/log v0.14.6-0.20231202035202-ed7a02cad0b4 // indirectgithub.com/anacrolix/missinggo v1.3.0 // indirectgithub.com/anacrolix/missinggo/perf v1.0.0 // indirectgithub.com/anacrolix/mmsg v1.0.0 // indirectgithub.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 // indirectgithub.com/anacrolix/stm v0.5.0 // indirectgithub.com/anacrolix/sync v0.5.1 // indirectgithub.com/anacrolix/upnp v0.1.3 // indirectgithub.com/anacrolix/utp v0.2.0 // indirectgithub.com/bahlo/generic-list-go v0.2.0 // indirectgithub.com/benbjohnson/immutable v0.4.3 // indirectgithub.com/bits-and-blooms/bitset v1.13.0 // indirectgithub.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirectgithub.com/cloudflare/circl v1.3.3 // indirectgithub.com/davecgh/go-spew v1.1.1 // indirectgithub.com/dlclark/regexp2 v1.10.0 // indirectgithub.com/dustin/go-humanize v1.0.1 // indirectgithub.com/edsrzf/mmap-go v1.1.0 // indirectgithub.com/emirpasic/gods v1.18.1 // indirectgithub.com/felixge/httpsnoop v1.0.1 // indirectgithub.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirectgithub.com/go-git/go-billy/v5 v5.4.1 // indirectgithub.com/go-llsqlite/adapter v0.1.0 // indirectgithub.com/go-llsqlite/crawshaw v0.5.0 // indirectgithub.com/go-logr/logr v1.4.1 // indirectgithub.com/go-logr/stdr v1.2.2 // indirectgithub.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirectgithub.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirectgithub.com/google/btree v1.1.2 // indirectgithub.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirectgithub.com/google/uuid v1.5.0 // indirectgithub.com/gorilla/websocket v1.5.1 // indirectgithub.com/huandu/xstrings v1.4.0 // indirectgithub.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirectgithub.com/kevinburke/ssh_config v1.2.0 // indirectgithub.com/mattn/go-colorable v0.1.13 // indirectgithub.com/mattn/go-isatty v0.0.20 // indirectgithub.com/mschoch/smat v0.2.0 // indirectgithub.com/pion/datachannel v1.5.5 // indirectgithub.com/pion/dtls/v2 v2.2.9 // indirectgithub.com/pion/ice/v2 v2.3.12 // indirectgithub.com/pion/interceptor v0.1.25 // indirectgithub.com/pion/logging v0.2.2 // indirectgithub.com/pion/mdns v0.0.9 // indirectgithub.com/pion/randutil v0.1.0 // indirectgithub.com/pion/rtcp v1.2.13 // indirectgithub.com/pion/rtp v1.8.3 // indirectgithub.com/pion/sctp v1.8.9 // indirectgithub.com/pion/sdp/v3 v3.0.6 // indirectgithub.com/pion/srtp/v2 v2.0.18 // indirectgithub.com/pion/stun v0.6.1 // indirectgithub.com/pion/transport/v2 v2.2.4 // indirectgithub.com/pion/turn/v2 v2.1.4 // indirectgithub.com/pion/webrtc/v3 v3.2.24 // indirectgithub.com/pjbgf/sha1cd v0.3.0 // indirectgithub.com/pmezard/go-difflib v1.0.0 // indirectgithub.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirectgithub.com/rs/dnscache v0.0.0-20230804202142-fc85eb664529 // indirectgithub.com/sergi/go-diff v1.1.0 // indirectgithub.com/skeema/knownhosts v1.2.0 // indirectgithub.com/stretchr/testify v1.8.4 // indirectgithub.com/tidwall/btree v1.7.0 // indirectgithub.com/xanzy/ssh-agent v0.3.3 // indirectgithub.com/xiaoqidun/setft v0.0.0-20220310121541-be86327699ad // indirectgo.opentelemetry.io/otel v1.22.0 // indirectgo.opentelemetry.io/otel/metric v1.22.0 // indirectgo.opentelemetry.io/otel/trace v1.22.0 // indirectgolang.org/x/crypto v0.18.0 // indirectgolang.org/x/mod v0.14.0 // indirectgolang.org/x/net v0.20.0 // indirectgolang.org/x/sys v0.16.0 // indirectgolang.org/x/text v0.14.0 // indirectgolang.org/x/time v0.5.0 // indirectgolang.org/x/tools v0.17.0 // indirectgopkg.in/warnings.v0 v0.1.2 // indirectgopkg.in/yaml.v3 v3.0.1 // indirectmodernc.org/libc v1.40.6 // indirectmodernc.org/mathutil v1.6.0 // indirectmodernc.org/memory v1.7.2 // indirectmodernc.org/sqlite v1.28.0 // indirectzombiezen.com/go/sqlite v1.1.0 // indirect
)
支持的协议有 BitTorrent、SOCKS5、Http
NodeJS 引擎 ECMAScript、Node.js
gopeed flutter 前端
目录包
ui/flutter/pubspec.yaml
dependencies:flutter:sdk: flutterflutter_localizations:sdk: flutter# The following adds the Cupertino Icons font to your application.# Use with the CupertinoIcons class for iOS style icons.cupertino_icons: ^1.0.2get: ^4.6.5lottie: ^1.4.2styled_widget: ^0.4.0+3context_menus: ^1.0.2json_annotation: ^4.8.1dio: ^5.2.1path_provider: ^2.1.1file_picker: 5.3.1macos_secure_bookmarks: ^0.2.1rounded_loading_button_plus: ^3.0.1url_launcher: ^6.1.6logger: ^1.3.0desktop_drop: ^0.4.3package_info_plus: ^4.0.0fluent_ui: ^4.4.0path: anybadges: ^3.0.3app_links: ^3.4.2uri_to_file: ^0.2.0window_manager: ^0.3.4autoscale_tabbarview: ^1.0.2share_plus: ^7.1.0flutter_form_builder: ^9.1.1form_builder_validators: ^9.0.0flutter_foreground_task: ^6.1.2open_filex: ^4.3.4tray_manager: ^0.2.1lecle_downloads_path_provider: ^0.0.2+8hive: ^2.2.3
dev_dependencies:flutter_test:sdk: flutter# The "flutter_lints" package below contains a set of recommended lints to# encourage good coding practices. The lint set provided by the package is# activated in the `analysis_options.yaml` file located at the root of your# package. See that file for information about deactivating specific lint# rules and activating additional ones.flutter_lints: ^2.0.0ffigen: ^8.0.2# build json model: dart run build_runner build --delete-conflicting-outputsbuild_runner: ^2.2.1json_serializable: ^6.3.2flutter_launcher_icons: ^0.13.1
ffigen 方式读取 go 动态库
dio 拉取数据
fluent_ui 组件库
getx 方式管理路由、响应数据
styled_widget 简化前端视图代码
hive 前端本地数据
build_runner、json_serializable 自动化实例 entity 对象
程序启动时开启服务
代码
https://github.com/GopeedLab/gopeed
小结
Gopeed 是一款基于 Flutter 开发的现代化下载工具,具有轻量、原生、全平台支持以及高速下载的特点。它不仅美观易用,而且开源,并且支持多种下载协议,包括 HTTP、BitTorrent、Magnet 等。无论是对于 Flutter 开发者还是下载工具用户,Gopeed 都是一个值得关注和尝试的项目。
感谢阅读本文
如果有什么建议,请在评论中让我知道。我很乐意改进。
flutter 学习路径
- Flutter 优秀插件推荐 https://flutter.ducafecat.com
- Flutter 基础篇1 - Dart 语言学习 https://ducafecat.com/course/dart-learn
- Flutter 基础篇2 - 快速上手 https://ducafecat.com/course/flutter-quickstart-learn
- Flutter 实战1 - Getx Woo 电商APP https://ducafecat.com/course/flutter-woo
- Flutter 实战2 - 上架指南 Apple Store、Google Play https://ducafecat.com/course/flutter-upload-apple-google
- Flutter 基础篇3 - 仿微信朋友圈 https://ducafecat.com/course/flutter-wechat
- Flutter 实战3 - 腾讯 tim 即时通讯开发 https://ducafecat.com/course/flutter-tim
© 猫哥
ducafecat.com
end