-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from fatedier/dev
bump version to v0.2.0
- Loading branch information
Showing
17 changed files
with
704 additions
and
57 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
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
### v0.2.0 | ||
|
||
- fftw 支持限速。 | ||
- fftw 支持限制每天使用的流量,超过限制后会自动从服务器端注销,第二天恢复。 | ||
|
||
### v0.1.0 | ||
|
||
- 支持上传下载进度条显示。 | ||
|
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
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
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
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,33 @@ | ||
package io | ||
|
||
import ( | ||
"context" | ||
"io" | ||
|
||
"golang.org/x/time/rate" | ||
) | ||
|
||
type RateReader struct { | ||
underlying io.Reader | ||
limiter *rate.Limiter | ||
} | ||
|
||
func NewRateReader(r io.Reader, limiter *rate.Limiter) *RateReader { | ||
return &RateReader{ | ||
underlying: r, | ||
limiter: limiter, | ||
} | ||
} | ||
|
||
func (rr *RateReader) Read(p []byte) (n int, err error) { | ||
n, err = rr.underlying.Read(p) | ||
if err != nil { | ||
return | ||
} | ||
|
||
err = rr.limiter.WaitN(context.Background(), n) | ||
if err != nil { | ||
return | ||
} | ||
return | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.