當前位置: 妍妍網 > 碼農

13.5K Star,高速下載工具

2024-04-29碼農

Hi,騷年,我是大 G,公眾號「 GitHub 指北 」會推薦 GitHub 上有趣有用的計畫,一分鐘 get 一個優秀的開源計畫,挖掘開源的價值,歡迎關註。

導語

今天推薦一個支持所有平台的現代下載管理器,是一款由 Golang+Flutter 開發的高速下載器,支持(HTTP、BitTorrent、Magnet)協定下載,並且支持全平台使用。除了基本的下載功能外,Gopeed 還是一款高度可客製化的下載器,支持透過對接 APIs 或者安裝和開發擴充套件來實作更多的功能。

效果預覽

開發

本計畫分為前端和後端兩個部份,前端使用 flutter ,後端使用 Golang ,兩邊透過 http 協定進行通訊,在 unix 系統下,使用的是 unix socket ,在 windows 系統下,使用的是 tcp 協定。

前端程式碼位於 ui/flutter 目錄下。

環境要求

  1. Golang 1.21+

  2. Flutter 3.16+

複制計畫

git clone [email protected]:GopeedLab/gopeed.git

編譯

桌面端

首先需要按照 flutter desktop 官網文件 進行環境配置,然後需要準備好 cgo 環境,具體可以自行搜尋。

構建命令:

  • windows

  • go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/windows/libgopeed.dll github.com/GopeedLab/gopeed/bind/desktop
    cd ui/flutter
    flutter build windows

  • macos

  • go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/macos/Frameworks/libgopeed.dylib github.com/GopeedLab/gopeed/bind/desktop
    cd ui/flutter
    flutter build macos

  • linux

  • go build -tags nosqlite -ldflags="-w -s" -buildmode=c-shared -o ui/flutter/linux/bundle/lib/libgopeed.so github.com/GopeedLab/gopeed/bind/desktop
    cd ui/flutter
    flutter build linux

    移動端

    同樣的也是需要準備好 cgo 環境,接著安裝 gomobile

    go install golang.org/x/mobile/cmd/gomobile@latest
    go get golang.org/x/mobile/bind
    gomobile init

    構建命令:

  • android

  • gomobile bind -tags nosqlite -ldflags="-w -s" -o ui/flutter/android/app/libs/libgopeed.aar -target=android -androidapi 19 -javapkg="com.gopeed" github.com/GopeedLab/gopeed/bind/mobile
    cd ui/flutter
    flutter build apk

  • ios

  • gomobile bind -tags nosqlite -ldflags="-w -s" -o ui/flutter/ios/Frameworks/Libgopeed.xcframework -target=ios github.com/GopeedLab/gopeed/bind/mobile
    cd ui/flutter
    flutter build ios --no-codesign

    Web 端

    構建命令:

    cd ui/flutter
    flutter build web
    cd ../../
    rm -rf cmd/web/dist
    cp -r ui/flutter/build/web cmd/web/dist
    go build -tags nosqlite,web -ldflags="-s -w" -o bin/ github.com/GopeedLab/gopeed/cmd/web

    源碼地址

    1. 點選下方的公眾號;

    2. 在後台發訊息「 下載 」即可獲取。

    結語

    一個高速下載工具,它支持所有平台。無論你是在 Windows、Mac 還是 Linux 上使用,Gopeed 都能為你提供快速、穩定的下載體驗。它具有強大的下載加速功能,可以幫助使用者以更高的速度下載檔,節省時間和頻寬資源。