From ed6d86fc1c22c063706919f2fad3e54187101108 Mon Sep 17 00:00:00 2001 From: zijiren233 Date: Fri, 13 Oct 2023 09:54:19 +0800 Subject: [PATCH] Feat: http read seeker with start offset --- proxy/read_seeker.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/proxy/read_seeker.go b/proxy/read_seeker.go index 0a979cc..5c883f0 100644 --- a/proxy/read_seeker.go +++ b/proxy/read_seeker.go @@ -71,6 +71,14 @@ func WithContentLength(contentLength int64) HttpReadSeekerConf { } } +func WithStartOffset(offset int64) HttpReadSeekerConf { + return func(h *HttpReadSeeker) { + if offset >= 0 { + h.offset = offset + } + } +} + func NewHttpReadSeeker(url string, conf ...HttpReadSeekerConf) *HttpReadSeeker { rs := &HttpReadSeeker{ offset: 0,