# Geonode

{% hint style="info" %}
API documentation: <https://torchlabs.readme.io/>
{% endhint %}

### **How to generate sticky proxies:**

```javascript
const string = (length) => {
  let result = "";
  const characters = "abcdefghijklmnopqrstuvwxyz1234567890";
  const charactersLength = characters.length;
  for (let i = 0; i < length; i++) {
    result += characters.charAt(Math.floor(Math.random() * charactersLength));
  }
  return result;
};

function proxyGenerationSticky(amount, country, username, password) {
  const proxy = [];
  for (var i = 0; i < parseInt(amount); i++) {
    proxy.push(
      `premium-residential.geonode.com:10000:${username}-country-${country.toLowerCase()}-session-${string(
        8
      )}-lifetime-60:${password}\n`
    );
  }
  return proxy.join("");
}
```

### How to generate rotating proxies:

```javascript
function proxyGenerationRotating(amount, country, username, password) {
  const proxy = [];
  for (var i = 0; i < parseInt(amount); i++) {
    proxy.push(
      `premium-residential.geonode.com:9000:${username}-country-${country.toLowerCase()}:${password}\n`
    );
  }
  return proxy.join("");
}
```

```javascript
    US: "USA",
    CA: "Canada",
    GB: "GB",
    DE: "Germany",
    FR: "France",
    ES: "Spain",
    IT: "Italy",
    SE: "Sweden",
    GR: "Greece",
    PT: "Portugal",
    NL: "Netherlands",
    BE: "Belgium",
    RU: "Russia",
    UA: "Ukraine",
    PL: "Poland",
    IL: "Israel",
    TR: "Turkey",
    AU: "Australia",
    MY: "Malaysia",
    TH: "Thailand",
    KR: "South Korea",
    JP: "Japan",
    PH: "Philippines",
    SG: "Singapore",
    CN: "China",
    HK: "Hong Kong",
    TW: "Taiwan",
    IN: "India",
    PK: "Pakistan",
    IR: "Iran",
    ID: "Indonesia",
    AZ: "Azerbaijan",
    KZ: "Kazakhstan",
    AE: "UAE",
    MX: "Mexico",
    BR: "Brazil",
    AR: "Argentina",
    CL: "Chile",
    PE: "Peru",
    EC: "Ecuador",
    CO: "Colombia",
    ZA: "South Africa",
    EG: "Egypt",
    AO: "Angola",
    CM: "Cameroon",
    CF: "Central African Republic",
    TD: "Chad",
    BJ: "Benin",
    ET: "Ethiopia",
    DJ: "Djibouti",
    GM: "Gambia",
    GH: "Ghana",
    CI: "Côte d'Ivoire",
    KE: "Kenya",
    LR: "Liberia",
    MG: "Madagascar",
    ML: "Mali",
    MR: "Mauritania",
    MU: "Mauritius",
    MA: "Morocco",
    MZ: "Mozambique",
    NG: "Nigeria",
    SN: "Senegal",
    SC: "Seychelles",
    ZW: "Zimbabwe",
    SS: "South Sudan",
    SD: "Sudan",
    TG: "Togo",
    TN: "Tunisia",
    UG: "Uganda",
    ZM: "Zambia",
    AF: "Afghanistan",
    BH: "Bahrain",
    BD: "Bangladesh",
    AM: "Armenia",
    BT: "Bhutan",
    MM: "Myanmar",
    KH: "Cambodia",
    GE: "Georgia",
    IQ: "Iraq",
    JO: "Jordan",
    LB: "Lebanon",
    MV: "Maldives",
    MN: "Mongolia",
    OM: "Oman",
    QA: "Qatar",
    SA: "Saudi Arabia",
    VN: "Vietnam",
    TM: "Turkmenistan",
    UZ: "Uzbekistan",
    YE: "Yemen",
    AL: "Albania",
    AD: "Andorra",
    AT: "Austria",
    BA: "Bosnia and Herzegovina",
    BG: "Bulgaria",
    BY: "Belarus",
    HR: "Croatia",
    CY: "Cyprus",
    CZ: "Czech Republic",
    DK: "Denmark",
    EE: "Estonia",
    FI: "Finland",
    HU: "Hungary",
    IS: "Iceland",
    IE: "Ireland",
    LV: "Latvia",
    LI: "Liechtenstein",
    LT: "Lithuania",
    LU: "Luxembourg",
    MT: "Malta",
    MC: "Monaco",
    MD: "Moldova",
    ME: "Montenegro",
    NO: "Norway",
    RO: "Romania",
    RS: "Serbia",
    SK: "Slovakia",
    SI: "Slovenia",
    CH: "Switzerland",
    MK: "Macedonia",
    BS: "Bahamas",
    BZ: "Belize",
    VG: "British Virgin Islands",
    CR: "Costa Rica",
    CU: "Cuba",
    DM: "Dominica",
    HT: "Haiti",
    HN: "Honduras",
    JM: "Jamaica",
    AW: "Aruba",
    PA: "Panama",
    PR: "Puerto Rico",
    TT: "Trinidad and Tobago",
    FJ: "Fiji",
    NZ: "New Zealand",
    BO: "Bolivia",
    PY: "Paraguay",
    UY: "Uruguay",
    VE: "Venezuela",
  }
```

### Other Optional Features

#### **Selecting State**: <a href="#selecting-state" id="selecting-state"></a>

To get a proxy from a specific US state, add the `state` flag to the proxy string. For example, `country-us-state-california`.

Here are a few examples of valid combinations of `state` parameters:

`country-us-state-georgia`

`country-us-state-arizona`

`country-us-state-florida`

`country-us-state-california`

{% file src="<https://633083225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsxMhtMHGoOKgipGL3q34%2Fuploads%2FDcaYguQc3RZWmyg2HG0P%2Fgeonode_us_states.txt?alt=media&token=cf613bba-3cbd-4815-8a53-a1b1e1a0e8e4>" %}

**Selecting City:**

Add a `city` parameter to narrow down to city-level targeting. For example, `country-de-city-berlin` means that a proxy from Berlin, Germany, will handle the query.

Here are a few examples of valid combinations of `city` parameters:

`country-us-city-newyorkcity`

`country-ca-city-toronto`

`country-au-city-sydney`

`country-us-city-chicago`

{% file src="<https://633083225-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsxMhtMHGoOKgipGL3q34%2Fuploads%2F456K0im0eeFvtfLY15c7%2Fgeonode_cities.json?alt=media&token=c42a8af5-6b14-4755-97f9-0777010ee9a0>" %}

### White labeling

Use this method to brand your proxies with your own domain/comapny name

To brand the proxies under your domain follow these steps:

1. Open the DNS configuration for your domain.
2. Create a C Name Record pointing to the domain.
3. Whatever you enter in 'host' will decide the domain which points to our API IP.
4. Thus if your domain is [API.com](http://api.com/) and you enter the host premium pointing to the geonode domain, your proxies will be formatted [premium.yourdomain.com](http://premium.yourdomain.com/):port:user:pass
5. An example on Godaddy is linked below:

### FAQ

#### What is Authorization?

This is a header value you provide with every request. We are using Bearer token so send in the header like this: <mark style="color:red;">`"Authorization: Bearer <your api token>"`</mark>

* Im getting this error: <mark style="color:red;">`{"message":"username cannot be null or undefined.","timestamp":1634146275996}`</mark> how do I fix it?

Make sure you have this <mark style="color:red;">`"Content-Type": "application/json"`</mark> header present in your requests.

#### Headers

Please check on how to send requests with headers in whichever languages you are using.

POST Request:

```javascript
{
	"Authorization": "Bearer <your api token>",
	"Content-Type": "application/json"
} 
```

```javascript
curl --location --request POST 'https://example.com/proxy_api/v1/geonode/users/update' \
 --data-raw '{
 "userId": 3194569,
 "password": "3eqwd",
 "trafficLimit": 3
 }' -H "Authorization: Bearer <your api token>" -H "Content-Type: application/json"
```

GET Request:

```javascript
{
	"Authorization": "Bearer <your api token>",
}
```

```javascript
ava# Sample curl request
curl --location --request GET 'https://example.com/proxy_api/v1/geonode/users/1234' \
         -H "Authorization: Bearer <your api token>"
```
