Skip to content
This repository was archived by the owner on Mar 17, 2024. It is now read-only.

Commit 6c1fa94

Browse files
committed
Fixed new sourceIp argument, added doc
1 parent 6ceab6a commit 6c1fa94

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/LEClient.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,12 @@ class LEClient
6666
* @param array $certificateKeys Optional array containing location of all certificate files. Required paths are public_key, private_key, order and certificate/fullchain_certificate (you can use both or only one of them)
6767
* @param string $accountKeys The directory in which the account keys are stored. Is a subdir inside $certificateKeys. Defaults to '__account/'.(optional)
6868
* @param array $accountKeys Optional array containing location of account private and public keys. Required paths are private_key, public_key.
69+
* @param string $sourceIp Optional source IP address.
6970
*/
7071
public function __construct($email, $acmeURL = LEClient::LE_PRODUCTION, $log = LEClient::LOG_OFF, $certificateKeys = 'keys/', $accountKeys = '__account/', $sourceIp = false)
7172
{
7273
$this->log = $log;
73-
$this->sourceIp = false;
74+
$this->sourceIp = $sourceIp;
7475
if (is_bool($acmeURL))
7576
{
7677
if ($acmeURL === true) $this->baseURL = LEClient::LE_STAGING;

src/LEConnector.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class LEConnector
4646

4747
public $keyChange;
4848
public $newAccount;
49-
public $newNonce;
49+
public $newNonce;
5050
public $newOrder;
5151
public $revokeCert;
5252

@@ -56,12 +56,14 @@ class LEConnector
5656
private $log;
5757

5858
private $sourceIp = false;
59+
5960
/**
6061
* Initiates the LetsEncrypt Connector class.
6162
*
6263
* @param int $log The level of logging. Defaults to no logging. LOG_OFF, LOG_STATUS, LOG_DEBUG accepted.
6364
* @param string $baseURL The LetsEncrypt server URL to make requests to.
6465
* @param array $accountKeys Array containing location of account keys files.
66+
* @param string $sourceIp Optional source IP address.
6567
*/
6668
public function __construct($log, $baseURL, $accountKeys, $sourceIp = false)
6769
{
@@ -70,7 +72,7 @@ public function __construct($log, $baseURL, $accountKeys, $sourceIp = false)
7072
$this->log = $log;
7173
$this->getLEDirectory();
7274
$this->getNewNonce();
73-
$this->sourceIp = false;
75+
$this->sourceIp = $sourceIp;
7476
}
7577

7678
/**
@@ -114,9 +116,10 @@ private function request($method, $URL, $data = null)
114116
curl_setopt($handle, CURLOPT_HTTPHEADER, $headers);
115117
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
116118
curl_setopt($handle, CURLOPT_HEADER, true);
117-
if($this->sourceIp !== false) {
118-
curl_setopt($handle, CURLOPT_INTERFACE, $this->sourceIp);
119-
}
119+
if($this->sourceIp !== false) {
120+
curl_setopt($handle, CURLOPT_INTERFACE, $this->sourceIp);
121+
}
122+
120123
switch ($method) {
121124
case 'GET':
122125
break;

0 commit comments

Comments
 (0)