mirror of https://github.com/dnomd343/XProxy.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
680 B
30 lines
680 B
8 months ago
|
package upstream
|
||
|
|
||
|
import (
|
||
|
"io"
|
||
|
urlpkg "net/url"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// Upstream interface is an abstraction that supports initiating request and
|
||
|
// returning information such as data streams.
|
||
|
type Upstream interface {
|
||
|
// Tag function get the description of current upstream.
|
||
|
Tag() (tag string)
|
||
|
|
||
|
// Request function initiates a request, returns the data stream and last
|
||
|
// modification time, or an error information.
|
||
|
Request() (stream io.ReadCloser, lastModify time.Time, err error)
|
||
|
}
|
||
|
|
||
|
func NewLocalAsset(tag string, path string) Upstream {
|
||
|
return &localAsset{
|
||
|
tag: tag,
|
||
|
path: path,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func NewRemoteAsset(url string, proxy *urlpkg.URL) Upstream {
|
||
|
return &remoteAsset{}
|
||
|
}
|