From 98a72a50ac94076c58fddeb43faa27144dad555a Mon Sep 17 00:00:00 2001 From: AlexNodex Date: Mon, 29 Jun 2020 13:20:40 +0100 Subject: [PATCH 1/2] Update Client.php Added source_ip as a config option --- src/Client.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Client.php b/src/Client.php index ecc2ec0..9cd4153 100644 --- a/src/Client.php +++ b/src/Client.php @@ -119,6 +119,7 @@ class Client * @type Filesystem $fs Filesystem for storage of static data * @type string $basePath The base path for the filesystem (used to store account information and csr / keys * @type string $username The acme username + * @type string $source_ip The source IP for Guzzle (via curl.options) to bind to (defaults to 0.0.0.0 [OS default]) * } */ public function __construct($config = []) @@ -371,6 +372,9 @@ protected function getHttpClient() 'base_uri' => ( ($this->getOption('mode', self::MODE_LIVE) == self::MODE_LIVE) ? self::DIRECTORY_LIVE : self::DIRECTORY_STAGING), + 'curl.options'=>[ + 'CURLOPT_INTERFACE'=>($this->getOption('source_ip',false) !== false) ? $this->config['source_ip'] : '0.0.0.0' + ] ]); } return $this->httpClient; From 660bf6b961433ac8c682ac2cb915031f8c8f8210 Mon Sep 17 00:00:00 2001 From: peterbakker Date: Thu, 2 Jul 2020 14:14:13 +0200 Subject: [PATCH 2/2] formatting & minor optimalisation for getOption --- src/Client.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.php b/src/Client.php index 9cd4153..b141632 100644 --- a/src/Client.php +++ b/src/Client.php @@ -369,11 +369,11 @@ protected function getHttpClient() { if ($this->httpClient === null) { $this->httpClient = new HttpClient([ - 'base_uri' => ( + 'base_uri' => ( ($this->getOption('mode', self::MODE_LIVE) == self::MODE_LIVE) ? self::DIRECTORY_LIVE : self::DIRECTORY_STAGING), - 'curl.options'=>[ - 'CURLOPT_INTERFACE'=>($this->getOption('source_ip',false) !== false) ? $this->config['source_ip'] : '0.0.0.0' + 'curl.options' => [ + 'CURLOPT_INTERFACE' => $this->getOption('source_ip', '0.0.0.0') ] ]); }