소스 검색

Optimize GetASN()

Removed python dependency; ip-api can return specific fields in raw text, there's no need to call Python to parse the JSON response.
pull/157/head
Vlad C 4 년 전
committed by GitHub
부모
커밋
5956e8f0e1
No known key found for this signature in database GPG 키 ID: 4AEE18F83AFDEB23
1개의 변경된 파일1개의 추가작업 그리고 3개의 파일을 삭제
  1. +1
    -3
      README.md

+ 1
- 3
README.md 파일 보기

@@ -4224,7 +4224,6 @@ Unsuccessful domain name resolution.
```bash
# Dependencies:
# - curl
# - python

function GetASN() {

@@ -4233,8 +4232,7 @@ function GetASN() {
local _curl_base="curl --request GET"
local _timeout="15"

_asn=$($_curl_base -ks -m "$_timeout" "http://ip-api.com/json/${_ip}" | \
python -c 'import sys, json; print json.load(sys.stdin)["as"]' 2>/dev/null)
_asn=$($_curl_base -ks -m "$_timeout" "http://ip-api.com/line/${_ip}?fields=as")

_state=$(echo $?)



불러오는 중...
취소
저장