Fake Mirrors
    Preparing search index...

    Interface ProxyRepository

    Represents a proxy repository.

    interface ProxyRepository {
        create(
            campaignId: string,
            proxyId: string,
            url: string,
            lockSecret: string,
        ): Promise<void>;
        delete(
            campaignId: string,
            proxyId: string,
            lockSecret: string,
        ): Promise<void>;
        disable(
            campaignId: string,
            proxyId: string,
            lockSecret: string,
        ): Promise<void>;
        enable(
            campaignId: string,
            proxyId: string,
            lockSecret: string,
        ): Promise<void>;
        list(campaignId: string): Promise<ProxyModel[] | null>;
        read(campaignId: string, proxyId: string): Promise<ProxyModel | null>;
    }

    Implemented by

    Methods

    • Creates a new proxy in the specified campaign.

      The proxy 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 proxy in

      • proxyId: string

        The unique identifier for the new proxy

      • url: string

        The proxy URL

      • 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 proxy with the same ID already exists

      DatabaseError If url is already used by another proxy in the campaign

    • Delete a proxy model by its ID.

      The proxy must be disabled before it can be deleted.

      Parameters

      • campaignId: string

        The ID of the campaign containing the proxy

      • proxyId: string

        The proxy ID to delete

      • 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 proxy does not exist

      DatabaseError If the proxy is still enabled

    • Disables a proxy, stopping traffic routing.

      Existing sessions using this proxy will be automatically re-assigned to another enabled proxy upon their next authorization.

      Parameters

      • campaignId: string

        The ID of the campaign containing the proxy

      • proxyId: string

        The proxy 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 proxy does not exist

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

      Enabled proxies are automatically selected by the session creation logic using random load balancing.

      Parameters

      • campaignId: string

        The ID of the campaign containing the proxy

      • proxyId: string

        The proxy 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 proxy does not exist

    • Lists all proxies in a campaign.

      Proxies are ordered by creation time (oldest first).

      Parameters

      • campaignId: string

        The ID of the campaign to list proxies for

      Returns Promise<ProxyModel[] | null>

      An array of proxy models, or null if the campaign does not exist

    • Reads a proxy model by its ID.

      Parameters

      • campaignId: string

        The ID of the campaign containing the proxy

      • proxyId: string

        The proxy ID to read

      Returns Promise<ProxyModel | null>

      The proxy model, or null if not found