Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base",
"default:automergeDigest"
],
"packageRules": [
{
"matchDatasources": ["go", "github-releases", "github-tags"],
"matchUpdateTypes": ["minor", "patch", "pin", "digest"],
"automerge": true
}
"config:recommended"
]
}

51 changes: 29 additions & 22 deletions .github/workflows/codetests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,31 @@ name: test-and-lint
on:
pull_request:
branches:
- main
- main
permissions:
contents: read
jobs:
codespell:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: codespell-project/actions-codespell@v2
with:
skip: .git,go.sum
ignore_words_list: SuperSeeding
# Runs `go test` against 3 operating systems.
# gotest:
# strategy:
# matrix:
# os: [macos, windows, ubuntu]
# runs-on: ${{ matrix.os }}-latest
# steps:
# - uses: actions/checkout@v3.2.0
# - uses: actions/setup-go@v3
# with:
# go-version: 1.19
# - name: go-test
# run: go test -race -covermode=atomic ./...

gotest:
strategy:
matrix:
os: [macos, windows, ubuntu]
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-go@v7
with:
go-version: stable
- name: go-test
run: go test -race -v -covermode=atomic ./...
# Runs golangci-lint on macos against freebsd and macos.
golangci-darwin:
strategy:
Expand All @@ -30,14 +37,14 @@ jobs:
env:
GOOS: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v5
- uses: actions/setup-go@v7
with:
go-version: stable
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v7
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: 'v1.55'
version: v2.13.0
# Runs golangci-lint on linux against linux and windows.
golangci-linux:
strategy:
Expand All @@ -48,11 +55,11 @@ jobs:
env:
GOOS: ${{ matrix.os }}
steps:
- uses: actions/setup-go@v5
- uses: actions/setup-go@v7
with:
go-version: stable
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
- uses: actions/checkout@v7
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
uses: golangci/golangci-lint-action@v9
with:
version: 'v1.55'
version: v2.13.0
63 changes: 48 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,52 @@
version: '2'
linters:
enable-all: true
default: all
disable:
# deprecated
- maligned
- scopelint
- interfacer
- golint
- exhaustivestruct
- nosnakecase
- structcheck
- deadcode
- varcheck
- ifshort
# unused
- dupl
- exhaustruct
- exhaustruct_v5
Comment thread
davidnewhall marked this conversation as resolved.
Resolved
- musttag
- nlreturn
- tagliatelle
run:
timeout: 3m
- noinlineerr
- wsl
- wsl_v5
- funcorder
- gomodguard
settings:
depguard:
rules:
main:
files:
- $all
allow:
- $gostd
- github.com/stretchr/testify
- golift.io/qbit
- golang.org/x/net
exclusions:
generated: lax
presets:
- std-error-handling
rules:
- linters:
- err113
- forcetypeassert
- funlen
- gochecknoglobals
- lll
- goconst
path: (.+)_test\.go
paths:
- test
- queue

issues:
max-issues-per-linter: 0
max-same-issues: 0
formatters:
enable:
- gci
- gofmt
- gofumpt
- goimports
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021-2023 Go Lift - Building Strong Go Tools
Copyright (c) 2021-2026 Go Lift - Building Strong Go Tools

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
52 changes: 36 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,64 @@
# Go Library: qbit
# qbit

Go Library used to interact with Qbittorrent. This library is not full-featured,
and probably only provides read-only methods to view the download list.
[![GoDoc](https://godoc.org/golift.io/qbit?status.svg)](https://pkg.go.dev/golift.io/qbit)
[![Go Report Card](https://goreportcard.com/badge/golift.io/qbit)](https://goreportcard.com/report/golift.io/qbit)
[![MIT License](http://img.shields.io/:license-mit-blue.svg)](https://github.com/golift/qbit/blob/main/LICENSE)

At the time of this writing (creation), the library only supports logging in,
and collecting transfer info.
Go library to interact with the [qBittorrent](https://github.com/qbittorrent/qBittorrent) Web API.

If you'd like new features, please open a GitHub issue or pull request.
This is not a full client. It covers login (including HTTP basic auth), listing transfers,
listing categories, and setting a torrent category. If you need more of the API, please
[open an issue](https://github.com/golift/qbit/issues/new) or a pull request.

Example:
This library is used by [Notifiarr](https://github.com/Notifiarr/notifiarr/).

qBittorrent 5.2+ returns HTTP 204 on login and other empty WebAPI responses.
Older 200/`Ok.` logins still work.

## Install

```shell
go get golift.io/qbit
```

## Example

```go
package main

import (
"context"
"log"
"net/http"
"time"

"golift.io/qbit"
)

func main() {
config := &qbit.Config{
URL: "http://localhost:8080",
User: "admin",
Pass: "qbitpassword",
}

qbit, err := qbit.New(config)
q, err := qbit.New(context.Background(), &qbit.Config{
URL: "http://localhost:8080",
User: "admin",
Pass: "qbitpassword",
// Optional HTTP basic auth in front of the Web UI:
// HTTPUser: "nginx",
// HTTPPass: "secret",
Client: &http.Client{Timeout: time.Minute},
})
if err != nil {
log.Fatalln("[ERROR]", err)
}

xfers, err := qbit.GetXfers()
xfers, err := q.GetXfers()
if err != nil {
log.Fatalln("[ERROR]", err)
}

for _, xfer := range xfers {
log.Println(xfer.Name, xfer.Progress)
log.Println(xfer.Name, xfer.Progress, xfer.SavePath)
}
}
```

`New` logs in immediately. `NewNoAuth` skips that and logs in on the first API call
(useful when you only need the client constructed at startup).
10 changes: 8 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module golift.io/qbit

go 1.17
go 1.25.0

require golang.org/x/net v0.27.0
require golang.org/x/net v0.58.0 // publicsuffix, cookiejar.

// All of this is for the tests.
require (
github.com/stretchr/testify v1.12.1 // assert!
go.yaml.in/yaml/v3 v3.0.5 // indirect
)
33 changes: 6 additions & 27 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds=
golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU=
golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=
golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE=
github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg=
go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw=
go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg=
golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To=
golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU=
Loading
Loading