crproxy

package module
v0.8.0-rc.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 19, 2024 License: MIT Imports: 36 Imported by: 0

README

CRProxy (Container Registry Proxy)

CRProxy is a generic image proxy

Add the prefix m.daocloud.io/ to all places that need to use images

m.daocloud.io

you can deploy your own image proxy server if you need to.

Refer to

On Docker

Just add the prefix m.daocloud.io/

docker pull m.daocloud.io/docker.io/library/busybox

On Kubernetes

Just add the prefix m.daocloud.io/

image: m.daocloud.io/docker.io/library/busybox

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSleepDuration

func GetSleepDuration(s geario.B, limit geario.B, r time.Duration) time.Duration

Types

type CRProxy

type CRProxy struct {
	// contains filtered or unexported fields
}

func NewCRProxy

func NewCRProxy(opts ...Option) (*CRProxy, error)

func (*CRProxy) AuthToken added in v0.8.0

func (c *CRProxy) AuthToken(rw http.ResponseWriter, r *http.Request)

func (*CRProxy) ServeHTTP

func (c *CRProxy) ServeHTTP(rw http.ResponseWriter, r *http.Request)

func (*CRProxy) Sync

func (c *CRProxy) Sync(rw http.ResponseWriter, r *http.Request)

func (*CRProxy) SyncImageLayer

func (c *CRProxy) SyncImageLayer(ctx context.Context, image string, filter func(pf manifestlist.PlatformSpec) bool, cb func(sp SyncProgress) error) error

type Logger

type Logger interface {
	Println(v ...interface{})
}

type ModifyInfo

type ModifyInfo struct {
	Host  string
	Image string
}

type Option

type Option func(c *CRProxy)

func WithBaseClient

func WithBaseClient(baseClient *http.Client) Option

func WithBlobsSpeedLimit

func WithBlobsSpeedLimit(limit geario.B, duration time.Duration) Option

func WithBlockFunc

func WithBlockFunc(blockFunc func(info *PathInfo) bool) Option

func WithDefaultRegistry added in v0.8.0

func WithDefaultRegistry(target string) Option

func WithDisableKeepAlives

func WithDisableKeepAlives(disableKeepAlives []string) Option

func WithDisableTagsList

func WithDisableTagsList(b bool) Option

func WithDomainAlias

func WithDomainAlias(domainAlias map[string]string) Option

func WithIPsSpeedLimit

func WithIPsSpeedLimit(limit geario.B, duration time.Duration) Option

func WithLimitDelay

func WithLimitDelay(b bool) Option

func WithLinkExpires

func WithLinkExpires(d time.Duration) Option

func WithLogger

func WithLogger(logger Logger) Option

func WithMaxClientSizeForEachRegistry

func WithMaxClientSizeForEachRegistry(clientSize int) Option

func WithPathInfoModifyFunc

func WithPathInfoModifyFunc(modify func(info *ModifyInfo) *ModifyInfo) Option

func WithPrivilegedIPs

func WithPrivilegedIPs(ips []string) Option
func WithRedirectLinks(l *url.URL) Option

func WithRetry

func WithRetry(retry int, retryInterval time.Duration) Option

func WithSimpleAuth added in v0.8.0

func WithSimpleAuth(b bool) Option

func WithStorageDriver

func WithStorageDriver(storageDriver storagedriver.StorageDriver) Option

func WithTotalBlobsSpeedLimit

func WithTotalBlobsSpeedLimit(limit geario.B) Option

func WithUserAndPass

func WithUserAndPass(userAndPass map[string]Userpass) Option

type PathInfo

type PathInfo struct {
	Host  string
	Image string

	TagsList  bool
	Manifests string
	Blobs     string
}

func ParseOriginPathInfo

func ParseOriginPathInfo(path string, defaultRegistry string) (*PathInfo, bool)

func (PathInfo) Path

func (p PathInfo) Path() (string, error)

type SyncProgress

type SyncProgress struct {
	Digest   string                     `json:"digest,omitempty"`
	Size     int64                      `json:"size,omitempty"`
	Status   string                     `json:"status,omitempty"`
	Platform *manifestlist.PlatformSpec `json:"platform,omitempty"`
}

type Token added in v0.8.0

type Token struct {
	ExpiresAt time.Time `json:"expires_at,omitempty"`
	Scope     string    `json:"scope,omitempty"`
	Service   string    `json:"service,omitempty"`
}

type Userpass

type Userpass struct {
	Username string
	Password string
}

Directories

Path Synopsis
cmd
internal
storage

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL