Fake Mirrors
    Preparing search index...

    Class RedisTargetRepository

    Redis target repository implementation.

    Hierarchy (View Summary)

    Implements

    Constructors

    Methods

    • Appends a label to a target.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target

      • targetId: string

        The target ID to append label to

      • label: string

        The label to add

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the target does not exist

    • Creates a new target in the specified campaign.

      The target will be created in a disabled state (isEnabled = false). Use enable() to activate it for traffic routing.

      Parameters

      • campaignId: string

        The ID of the campaign to create the target in

      • targetId: string

        The unique identifier for the new target

      • accessLevel: "transparent" | "landing"

        The access level

      • donorSecure: boolean

        Whether the donor server uses HTTPS

      • donorSub: string

        The donor subdomain

      • donorDomain: string

        The donor domain name

      • donorPort: number

        The donor server port

      • mirrorSecure: boolean

        Whether the mirror uses HTTPS

      • mirrorSub: string

        The mirror subdomain

      • mirrorPort: number

        The mirror server port

      • connectTimeout: number

        Connection timeout

      • simpleTimeout: number

        Simple request timeout

      • streamTimeout: number

        Streaming request timeout

      • headersSizeLimit: number

        Maximum headers size in bytes

      • bodySizeLimit: number

        Maximum body size in bytes

      • mainPage: string

        Custom main page content

      • notFoundPage: string

        Custom 404 page content

      • faviconIco: string

        Custom favicon content

      • robotsTxt: string

        Custom robots.txt content

      • sitemapXml: string

        Custom sitemap.xml content

      • allowWebSockets: boolean

        Whether to allow WebSocket connections

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If a target with the same ID already exists

      DatabaseError If the target donor is already used

      DatabaseError If the target mirror is already used

      DatabaseError If the mirror hostname is already taken

    • Disables a target, stopping traffic routing.

      When disabled, requests to the mirror hostname will not be proxied.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target

      • targetId: string

        The target ID to disable

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the target does not exist

    • Enables a target, making it available for traffic routing.

      When enabled, the mirror hostname becomes active and can be used for proxying requests to the donor server.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target

      • targetId: string

        The target ID to enable

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the target does not exist

    • Removes a label from a target.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target

      • targetId: string

        The target ID to remove label from

      • label: string

        The label to remove

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the target does not exist

    • Updates specific fields of a target model.

      Parameters

      • campaignId: string

        The ID of the campaign containing the target

      • targetId: string

        The target ID to update

      • connectTimeout: number | null | undefined

        Connection timeout

      • simpleTimeout: number | null | undefined

        Simple request timeout

      • streamTimeout: number | null | undefined

        Streaming request timeout

      • headersSizeLimit: number | null | undefined

        Maximum headers size in bytes

      • bodySizeLimit: number | null | undefined

        Maximum body size in bytes

      • mainPage: string | null | undefined

        Custom main page content

      • notFoundPage: string | null | undefined

        Custom 404 page content

      • faviconIco: string | null | undefined

        Custom favicon content

      • robotsTxt: string | null | undefined

        Custom robots.txt content

      • sitemapXml: string | null | undefined

        Custom sitemap.xml content

      • allowWebSockets: boolean | null | undefined

        Whether to allow WebSocket connections

      • lockSecret: string

        The campaign lock secret obtained from CampaignRepository.lock()

      Returns Promise<void>

      DatabaseError If the campaign does not exist

      DatabaseError If the campaign is not locked

      DatabaseError If the lock secret does not match

      DatabaseError If the target does not exist