crproxy

package module
v0.13.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 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

crproxy + registry(pull through cache mode)

  • for organizations and companies which need to serve big clusters
  • container-image-mirror
    • deploy into k8s with argocd
    • storage with pvc, s3(minio/oss compatible)
    • bind ssl with cert-manager and ingress

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 BlockInfo added in v0.12.3

type BlockInfo struct {
	IP   string
	Host string
	Name string
}

type CRProxy

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

func NewCRProxy

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

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, ip, image string, filter func(pf manifestlist.PlatformSpec) bool, cb func(sp SyncProgress) error) error

type ImageInfo added in v0.8.0

type ImageInfo struct {
	Host string
	Name string
}

type InfoCtxValue added in v0.9.0

type InfoCtxValue struct {
	LastRedirect string
}

func GetCtxValue added in v0.9.0

func GetCtxValue(ctx context.Context) *InfoCtxValue

type Option

type Option func(c *CRProxy)

func WithAllowHeadMethod added in v0.12.0

func WithAllowHeadMethod(allowHeadMethod bool) Option

func WithAuthenticator

func WithAuthenticator(authenticator *token.Authenticator) Option

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 *BlockInfo) (string, 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.Logger) Option

func WithManifestCacheDuration added in v0.12.0

func WithManifestCacheDuration(d time.Duration) Option

func WithMaxClientSizeForEachRegistry

func WithMaxClientSizeForEachRegistry(clientSize int) Option

func WithOverrideDefaultRegistry added in v0.8.0

func WithOverrideDefaultRegistry(overrideDefaultRegistry map[string]string) Option

func WithPathInfoModifyFunc

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

func WithPrivilegedFunc added in v0.9.0

func WithPrivilegedFunc(f func(r *http.Request, info *ImageInfo) bool) Option

func WithPrivilegedNoAuth added in v0.8.0

func WithPrivilegedNoAuth(b bool) Option
func WithRedirectLinks(l *url.URL) Option

func WithRedirectToOriginBlobFunc added in v0.9.0

func WithRedirectToOriginBlobFunc(f func(r *http.Request, info *ImageInfo) bool) 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 Userpass

type Userpass struct {
	Username string
	Password string
}

Directories

Path Synopsis
cmd
internal
pki
storage

Jump to

Keyboard shortcuts

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