Bu çeviri makine öğrenimi kullanılarak oluşturulmuştur ve %100 doğru olmayabilir. İngilizce versiyonu görüntüle

I2PControl JSON-RPC

I2PControl webapp üzerinden uzaktan router yönetimi API'si

————-ekleme kontrolü————–

I2PControl API Belgeleri

I2PControl, I2P router ile birlikte gelen (0.9.39 sürümünden itibaren) bir JSON-RPC 2.0 API’sidir. Yapılandırılmış JSON istekleri aracılığıyla router’ın kimlik doğrulamalı izlenmesini ve kontrolünü sağlar.

Varsayılan şifre: itoopie — bu fabrika varsayılanıdır ve güvenlik için hemen değiştirilmelidir.


1. Genel Bakış ve Erişim

ImplementationDefault EndpointProtocolEnabled by DefaultNotes
Java I2P (2.10.0+)http://127.0.0.1:7657/jsonrpc/HTTP❌ Must be enabled via WebApps (Router Console)Bundled webapp
i2pd (C++ implementation)https://127.0.0.1:7650/HTTPS✅ Enabled by defaultLegacy plugin behavior
Java I2P durumunda, **Router Console → WebApps → I2PControl** bölümüne gidip etkinleştirmeniz gerekir (otomatik başlatılacak şekilde ayarlayın). Etkin hale geldikten sonra, tüm yöntemler için önce kimlik doğrulaması yapmanız ve bir oturum token'ı almanız gerekir.

2. JSON-RPC Formatı

Tüm istekler JSON-RPC 2.0 yapısını takip eder:

{
  "jsonrpc": "2.0",
  "id": "1",
  "method": "MethodName",
  "params": {
    /* named parameters */
  }
}

Başarılı bir yanıt result alanı içerir; başarısızlık durumunda ise bir error nesnesi döndürülür:

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": { /* data */ }
}

veya

{
  "jsonrpc": "2.0",
  "id": "1",
  "error": {
    "code": -32001,
    "message": "Invalid password"
  }
}

3. Kimlik Doğrulama Akışı

İstek (Kimlik Doğrulama)

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "1",
        "method": "Authenticate",
        "params": {
          "API": 1,
          "Password": "itoopie"
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Başarılı Yanıt

{
  "jsonrpc": "2.0",
  "id": "1",
  "result": {
    "Token": "a1b2c3d4e5",
    "API": 1
  }
}

Bu Token‘ı sonraki tüm isteklerde params içinde eklemelisiniz.


4. Yöntemler ve Uç Noktalar

4.1 RouterInfo

Router hakkında anahtar telemetri verilerini getirir.

İstek Örneği

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "2",
        "method": "RouterInfo",
        "params": {
          "Token": "a1b2c3d4e5",
          "i2p.router.version": "",
          "i2p.router.status": "",
          "i2p.router.net.status": "",
          "i2p.router.net.tunnels.participating": "",
          "i2p.router.net.bw.inbound.1s": "",
          "i2p.router.net.bw.outbound.1s": ""
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Yanıt Alanları (result) Resmi dokümanlara göre (GetI2P): - i2p.router.status (String) — insan tarafından okunabilir durum - i2p.router.uptime (long) — milisaniye (veya eski i2pd için string) :contentReference[oaicite:0]{index=0} - i2p.router.version (String) — sürüm dizesi :contentReference[oaicite:1]{index=1} - i2p.router.net.bw.inbound.1s, i2p.router.net.bw.inbound.15s (double) — gelen bant genişliği B/s cinsinden :contentReference[oaicite:2]{index=2} - i2p.router.net.bw.outbound.1s, i2p.router.net.bw.outbound.15s (double) — giden bant genişliği B/s cinsinden :contentReference[oaicite:3]{index=3} - i2p.router.net.status (long) — sayısal durum kodu (aşağıdaki enum’a bakın) :contentReference[oaicite:4]{index=4} - i2p.router.net.tunnels.participating (long) — katılan tunnel sayısı :contentReference[oaicite:5]{index=5} - i2p.router.netdb.activepeers, fastpeers, highcapacitypeers (long) — netDB peer istatistikleri :contentReference[oaicite:6]{index=6} - i2p.router.netdb.isreseeding (boolean) — reseed’in aktif olup olmadığı :contentReference[oaicite:7]{index=7} - i2p.router.netdb.knownpeers (long) — toplam bilinen peer’lar :contentReference[oaicite:8]{index=8}

Durum Kodu Enum (i2p.router.net.status)

CodeMeaning
0OK
1TESTING
2FIREWALLED
3HIDDEN
4WARN_FIREWALLED_AND_FAST
5WARN_FIREWALLED_AND_FLOODFILL
6WARN_FIREWALLED_WITH_INBOUND_TCP
7WARN_FIREWALLED_WITH_UDP_DISABLED
8ERROR_I2CP
9ERROR_CLOCK_SKEW
10ERROR_PRIVATE_TCP_ADDRESS
11ERROR_SYMMETRIC_NAT
12ERROR_UDP_PORT_IN_USE
13ERROR_NO_ACTIVE_PEERS_CHECK_CONNECTION_AND_FIREWALL
14ERROR_UDP_DISABLED_AND_TCP_UNSET
---

4.2 GetRate

Belirli bir zaman penceresi boyunca oran metriklerini (örneğin bant genişliği, tunnel başarı oranı) almak için kullanılır.

İstek Örneği

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "3",
        "method": "GetRate",
        "params": {
          "Token": "a1b2c3d4e5",
          "Stat": "bw.combined",
          "Period": 60000
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Örnek Yanıt

{
  "jsonrpc": "2.0",
  "id": "3",
  "result": {
    "Rate": 12345.67
  }
}

4.3 RouterManager

Yönetimsel işlemler gerçekleştirin.

İzin verilen parametreler / yöntemler - Restart, RestartGraceful - Shutdown, ShutdownGraceful - Reseed, FindUpdates, Update :contentReference[oaicite:10]{index=10}

İstek Örneği

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "4",
        "method": "RouterManager",
        "params": {
          "Token": "a1b2c3d4e5",
          "Restart": true
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Başarılı Yanıt

{
  "jsonrpc": "2.0",
  "id": "4",
  "result": {
    "Restart": null
  }
}

4.4 NetworkSetting

Ağ yapılandırma parametrelerini al veya ayarla (portlar, upnp, bant genişliği paylaşımı, vb.)

İstek Örneği (mevcut değerleri al)

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "5",
        "method": "NetworkSetting",
        "params": {
          "Token": "a1b2c3d4e5",
          "i2p.router.net.ntcp.port": null,
          "i2p.router.net.ssu.port": null,
          "i2p.router.net.bw.share": null,
          "i2p.router.net.upnp": null
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Örnek Yanıt

{
  "jsonrpc": "2.0",
  "id": "5",
  "result": {
    "i2p.router.net.ntcp.port": "1234",
    "i2p.router.net.ssu.port": "5678",
    "i2p.router.net.bw.share": "50",
    "i2p.router.net.upnp": "true",
    "SettingsSaved": true,
    "RestartNeeded": false
  }
}

Not: 2.41’den önceki i2pd sürümleri string yerine sayısal türler döndürebilir — istemciler her ikisini de işleyebilmelidir. :contentReference[oaicite:11]{index=11}


4.5 Gelişmiş Ayarlar

İç router parametrelerini düzenlemeye izin verir.

İstek Örneği

curl -s -H "Content-Type: application/json" \
  -d '{
        "jsonrpc": "2.0",
        "id": "6",
        "method": "AdvancedSettings",
        "params": {
          "Token": "a1b2c3d4e5",
          "Set": {
            "router.sharePercentage": "75",
            "i2np.flushInterval": "6000"
          }
        }
      }' \
  http://127.0.0.1:7657/jsonrpc/

Yanıt Örneği

{
  "jsonrpc": "2.0",
  "id": "6",
  "result": {
    "Set": {
      "router.sharePercentage": "75",
      "i2np.flushInterval": "6000"
    }
  }
}

5. Hata Kodları

Standart JSON-RPC2 Hata Kodları

CodeMeaning
-32700JSON parse error
-32600Invalid request
-32601Method not found
-32602Invalid parameters
-32603Internal error
### I2PControl Özel Hata Kodları
CodeMeaning
-32001Invalid password provided
-32002No authentication token presented
-32003Authentication token doesn't exist
-32004The provided authentication token was expired and will be removed
-32005The version of the I2PControl API used wasn't specified, but is required to be specified
-32006The version of the I2PControl API specified is not supported by I2PControl
---

6. Kullanım ve En İyi Uygulamalar

  • Her zaman Token parametresini dahil edin (kimlik doğrulama yaparken hariç).
  • İlk kullanımda varsayılan parolayı (itoopie) değiştirin.
  • Java I2P için, I2PControl webapp’inin WebApps aracılığıyla etkinleştirildiğinden emin olun.
  • Küçük farklılıklara hazır olun: bazı alanlar I2P sürümüne bağlı olarak sayı veya metin olabilir.
  • Uzun durum metinlerini görüntü dostu çıktı için sarın.

Was this page helpful?