nslookupot 0.0.4 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +29 -0
- data/Gemfile +2 -2
- data/README.md +2 -1
- data/lib/nslookupot.rb +2 -1
- data/lib/nslookupot/cli.rb +10 -1
- data/lib/nslookupot/resolver.rb +16 -4
- data/lib/nslookupot/version.rb +1 -1
- data/nslookupot.gemspec +1 -0
- metadata +21 -7
- data/.travis.yml +0 -16
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4eb5fa336ed8346e9d7c160eaef21f11cf93245a5686b65b4ffded6357151104
         | 
| 4 | 
            +
              data.tar.gz: bf13181adc1bca7d72fcedd0eaf468b44e0c084812a157116cf0eb86f6179c6c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 9e1a9209b4cf62ff3101b249d3862385d672366deb980451461665743a14fd109815bdd91adb37cd25e16bef5b5bee1ce3ccf686bdceb58a6159c07189747f6c
         | 
| 7 | 
            +
              data.tar.gz: 3e9b364bb14a5b08b1612998aed4d2b0b91b8b233256725923f49efa7cfeb046a82df0952fb3087b863e807d2d203f094b405af7a8e575698a7d3240137d7381
         | 
| @@ -0,0 +1,29 @@ | |
| 1 | 
            +
            name: CI
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            on:
         | 
| 4 | 
            +
              push:
         | 
| 5 | 
            +
                branches:
         | 
| 6 | 
            +
                  - master
         | 
| 7 | 
            +
              pull_request:
         | 
| 8 | 
            +
                branches:
         | 
| 9 | 
            +
                  - '*'
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            jobs:
         | 
| 12 | 
            +
              ci:
         | 
| 13 | 
            +
                runs-on: ubuntu-latest
         | 
| 14 | 
            +
                strategy:
         | 
| 15 | 
            +
                  matrix:
         | 
| 16 | 
            +
                    ruby-version: ['2.6.x', '2.7.x']
         | 
| 17 | 
            +
                steps:
         | 
| 18 | 
            +
                  - name: Set up Ruby
         | 
| 19 | 
            +
                    uses: actions/setup-ruby@v1
         | 
| 20 | 
            +
                  - uses: actions/checkout@v1
         | 
| 21 | 
            +
                  - name: Install dependencies
         | 
| 22 | 
            +
                    run: |
         | 
| 23 | 
            +
                      gem --version
         | 
| 24 | 
            +
                      gem install bundler
         | 
| 25 | 
            +
                      bundle --version
         | 
| 26 | 
            +
                      bundle install
         | 
| 27 | 
            +
                  - name: Run test
         | 
| 28 | 
            +
                    run: |
         | 
| 29 | 
            +
                      bundle exec rake
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            # nslookupot
         | 
| 2 2 |  | 
| 3 3 | 
             
            [](https://badge.fury.io/rb/nslookupot)
         | 
| 4 | 
            -
            [](https://github.com/thekuwayama/nslookupot/actions?workflow=CI)
         | 
| 5 5 | 
             
            [](https://codeclimate.com/github/thekuwayama/nslookupot/maintainability)
         | 
| 6 6 |  | 
| 7 7 | 
             
            nslookupot is CLI that is `nslookup` over TLS (version 1.2).
         | 
| @@ -24,6 +24,7 @@ Usage: nslookupot [options] name | |
| 24 24 | 
             
                -s, --server VALUE               the name server IP address        (default 1.1.1.1)
         | 
| 25 25 | 
             
                -p, --port VALUE                 the name server port number       (default 853)
         | 
| 26 26 | 
             
                -h, --hostname VALUE             the name server hostname          (default cloudflare-dns.com)
         | 
| 27 | 
            +
                -n, --no-check-sni               no check SNI                      (default false)
         | 
| 27 28 | 
             
                -t, --type VALUE                 the type of the information query (default A)
         | 
| 28 29 | 
             
            ```
         | 
| 29 30 |  | 
    
        data/lib/nslookupot.rb
    CHANGED
    
    
    
        data/lib/nslookupot/cli.rb
    CHANGED
    
    | @@ -12,7 +12,8 @@ module Nslookupot | |
| 12 12 | 
             
                  opts = {
         | 
| 13 13 | 
             
                    server: '1.1.1.1',
         | 
| 14 14 | 
             
                    port: 853,
         | 
| 15 | 
            -
                    hostname: 'cloudflare-dns.com'
         | 
| 15 | 
            +
                    hostname: 'cloudflare-dns.com',
         | 
| 16 | 
            +
                    check_sni: true
         | 
| 16 17 | 
             
                  }
         | 
| 17 18 | 
             
                  type = 'A'
         | 
| 18 19 |  | 
| @@ -40,6 +41,14 @@ module Nslookupot | |
| 40 41 | 
             
                    opts[:hostname] = v
         | 
| 41 42 | 
             
                  end
         | 
| 42 43 |  | 
| 44 | 
            +
                  op.on(
         | 
| 45 | 
            +
                    '-n',
         | 
| 46 | 
            +
                    '--no-check-sni',
         | 
| 47 | 
            +
                    "no check SNI                      (default #{!opts[:check_sni]})"
         | 
| 48 | 
            +
                  ) do
         | 
| 49 | 
            +
                    opts[:check_sni] = false
         | 
| 50 | 
            +
                  end
         | 
| 51 | 
            +
             | 
| 43 52 | 
             
                  op.on(
         | 
| 44 53 | 
             
                    '-t',
         | 
| 45 54 | 
             
                    '--type VALUE',
         | 
    
        data/lib/nslookupot/resolver.rb
    CHANGED
    
    | @@ -5,11 +5,17 @@ module Nslookupot | |
| 5 5 | 
             
                # @param server [String]
         | 
| 6 6 | 
             
                # @param port [Integer]
         | 
| 7 7 | 
             
                # @param hostname [String]
         | 
| 8 | 
            -
                 | 
| 9 | 
            -
             | 
| 8 | 
            +
                # @param check_sni [bool]
         | 
| 9 | 
            +
                def initialize(
         | 
| 10 | 
            +
                  server: '1.1.1.1',
         | 
| 11 | 
            +
                  port: 853,
         | 
| 12 | 
            +
                  hostname: 'cloudflare-dns.com',
         | 
| 13 | 
            +
                  check_sni: true
         | 
| 14 | 
            +
                )
         | 
| 10 15 | 
             
                  @server = server
         | 
| 11 16 | 
             
                  @port = port
         | 
| 12 17 | 
             
                  @hostname = hostname # for SNI
         | 
| 18 | 
            +
                  @check_sni = check_sni
         | 
| 13 19 | 
             
                end
         | 
| 14 20 |  | 
| 15 21 | 
             
                # @param name [String]
         | 
| @@ -70,10 +76,16 @@ module Nslookupot | |
| 70 76 | 
             
                def gen_sock
         | 
| 71 77 | 
             
                  ts = TCPSocket.new(@server, @port)
         | 
| 72 78 | 
             
                  ctx = OpenSSL::SSL::SSLContext.new('TLSv1_2')
         | 
| 79 | 
            +
                  ctx.alpn_protocols = ['dot']
         | 
| 73 80 | 
             
                  sock = OpenSSL::SSL::SSLSocket.new(ts, ctx)
         | 
| 74 81 | 
             
                  sock.sync_close = true
         | 
| 75 | 
            -
                   | 
| 76 | 
            -
             | 
| 82 | 
            +
                  if @check_sni
         | 
| 83 | 
            +
                    sock.hostname = @hostname
         | 
| 84 | 
            +
                    sock.connect
         | 
| 85 | 
            +
                    sock.post_connection_check(@hostname)
         | 
| 86 | 
            +
                  else
         | 
| 87 | 
            +
                    sock.connect
         | 
| 88 | 
            +
                  end
         | 
| 77 89 |  | 
| 78 90 | 
             
                  sock
         | 
| 79 91 | 
             
                end
         | 
    
        data/lib/nslookupot/version.rb
    CHANGED
    
    
    
        data/nslookupot.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: nslookupot
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.8
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - thekuwayama
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-07-21 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         | 
| @@ -52,6 +52,20 @@ dependencies: | |
| 52 52 | 
             
                - - ">="
         | 
| 53 53 | 
             
                  - !ruby/object:Gem::Version
         | 
| 54 54 | 
             
                    version: '0'
         | 
| 55 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 56 | 
            +
              name: svcb_rr_patch
         | 
| 57 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 58 | 
            +
                requirements:
         | 
| 59 | 
            +
                - - ">="
         | 
| 60 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            +
                    version: '0'
         | 
| 62 | 
            +
              type: :runtime
         | 
| 63 | 
            +
              prerelease: false
         | 
| 64 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 | 
            +
                requirements:
         | 
| 66 | 
            +
                - - ">="
         | 
| 67 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            +
                    version: '0'
         | 
| 55 69 | 
             
            description: nslookup over TLS
         | 
| 56 70 | 
             
            email:
         | 
| 57 71 | 
             
            - thekuwayama@gmail.com
         | 
| @@ -60,9 +74,9 @@ executables: | |
| 60 74 | 
             
            extensions: []
         | 
| 61 75 | 
             
            extra_rdoc_files: []
         | 
| 62 76 | 
             
            files:
         | 
| 77 | 
            +
            - ".github/workflows/ci.yml"
         | 
| 63 78 | 
             
            - ".gitignore"
         | 
| 64 79 | 
             
            - ".rubocop.yml"
         | 
| 65 | 
            -
            - ".travis.yml"
         | 
| 66 80 | 
             
            - Gemfile
         | 
| 67 81 | 
             
            - LICENSE.txt
         | 
| 68 82 | 
             
            - README.md
         | 
| @@ -80,7 +94,7 @@ homepage: https://github.com/thekuwayama/nslookupot | |
| 80 94 | 
             
            licenses:
         | 
| 81 95 | 
             
            - MIT
         | 
| 82 96 | 
             
            metadata: {}
         | 
| 83 | 
            -
            post_install_message: | 
| 97 | 
            +
            post_install_message:
         | 
| 84 98 | 
             
            rdoc_options: []
         | 
| 85 99 | 
             
            require_paths:
         | 
| 86 100 | 
             
            - lib
         | 
| @@ -95,8 +109,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 95 109 | 
             
                - !ruby/object:Gem::Version
         | 
| 96 110 | 
             
                  version: '0'
         | 
| 97 111 | 
             
            requirements: []
         | 
| 98 | 
            -
            rubygems_version: 3. | 
| 99 | 
            -
            signing_key: | 
| 112 | 
            +
            rubygems_version: 3.2.3
         | 
| 113 | 
            +
            signing_key:
         | 
| 100 114 | 
             
            specification_version: 4
         | 
| 101 115 | 
             
            summary: nslookup over TLS
         | 
| 102 116 | 
             
            test_files:
         |