Skip to content

Commit eb794c1

Browse files
authored
Version 1.0.1
2 parents b4485ae + 786faaa commit eb794c1

File tree

5 files changed

+67
-78
lines changed

5 files changed

+67
-78
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ Exclamation symbols (:exclamation:) note something of importance e.g. breaking c
1111
### Fixed
1212
### Security
1313

14+
## [1.0.1] - 2017-05-09
15+
### Changed
16+
- Use more stable `longman/ip-tools` for IP matching.
17+
1418
## [1.0.0] - 2017-05-08
1519
### Changed
1620
- [:exclamation:][1.0.0-bc-move] Move to `php-telegram-bot/telegram-bot-manager` on packagist.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ try {
158158

159159
### Set vital bot parameters
160160

161-
The only vital parameters is the API key:
161+
The only vital parameter is the API key:
162162

163163
```php
164164
$bot = new BotManager([

composer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,10 @@
1717
"role": "Developer"
1818
}
1919
],
20-
"repositories": [
21-
{
22-
"type": "vcs",
23-
"url": "https://github.com/noplanman/Utils-IP-Tools"
24-
}
25-
],
2620
"require": {
2721
"php": "^7.0",
2822
"longman/telegram-bot": "^0.44",
29-
"allty/utils-ip": "dev-master"
23+
"longman/ip-tools": "^1.2"
3024
},
3125
"require-dev": {
3226
"jakub-onderka/php-parallel-lint": "^0.9.2",

composer.lock

Lines changed: 58 additions & 60 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/BotManager.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
namespace TelegramBot\TelegramBotManager;
1212

13-
use Allty\Utils\IpTools;
13+
use Longman\IPTools\Ip;
1414
use Longman\TelegramBot\Entities;
1515
use Longman\TelegramBot\Request;
1616
use Longman\TelegramBot\Telegram;
@@ -519,16 +519,9 @@ public function isValidRequest(): bool
519519
}
520520
}
521521

522-
$valid_ips = array_merge(
522+
return Ip::match($ip, array_merge(
523523
[self::TELEGRAM_IP_RANGE],
524524
(array) $this->params->getBotParam('valid_ips', [])
525-
);
526-
foreach ($valid_ips as $valid_ip) {
527-
if (IpTools::ipInRange($ip, $valid_ip)) {
528-
return true;
529-
}
530-
}
531-
532-
return false;
525+
));
533526
}
534527
}

0 commit comments

Comments
 (0)