Skip to content
Snippets Groups Projects
Select Git revision
  • c5d9a9a6fff39e8384148921a38384f771d4aff4
  • master default protected
  • 9.0
  • 8.0
  • 7.8
  • 7.6
  • 7.4
  • 7.2
  • 7.0
  • 0.6
  • rosuav/latex-markdown-renderer
  • rxnpatch/rxnpatch
  • marcus/gobject-introspection
  • rxnpatch/8.0
  • rosuav/pre-listening-ports
  • nt-tools
  • rosuav/async-annotations
  • rosuav/pgsql-ssl
  • rxnpatch/rxnpatch-broken/2023-10-06T094250
  • grubba/fdlib
  • grubba/wip/sakura/8.0
  • v8.0.2000
  • v8.0.1998
  • v8.0.1996
  • v8.0.1994
  • v8.0.1992
  • v8.0.1990
  • v8.0.1988
  • v8.0.1986
  • rxnpatch/clusters/8.0/2025-04-29T124414
  • rxnpatch/2025-04-29T124414
  • v8.0.1984
  • v8.0.1982
  • v8.0.1980
  • v8.0.1978
  • v8.0.1976
  • v8.0.1974
  • v8.0.1972
  • v8.0.1970
  • v8.0.1968
  • v8.0.1966
41 results

sql_util.pmod

Blame
  • onionoo.coffee 1.94 KiB
    # Commands:
    #   .atlas - Search using https://atlas.torproject.org
    #   .globe - Search using https://globe.torproject.org
    #   .dfri - Show status for Tor relays hosted by DFRI
    #
    # Author:
    #   osund
    
    module.exports = (robot) ->
    
      #onionoo_url = "https://onionoo.torproject.org"
      onionoo_url = "https://onionoo.thecthulhu.com"
    
      atlas_url = "https://atlas.torproject.org/#details/"
      globe_url = "https://globe.torproject.org/#/relay/"
      onion_atlas_url = "http://atlas777hhh7mcs7.onion/#details/"
      onion_globe_url = "http://globe223ezvh6bps.onion/#/relay/"
    
      relay_summary = (msg, service_url) ->
        name = msg.match[2]
        msg.http(onionoo_url + "/summary?search=" + name).get() (err, res, body) ->
            data = JSON.parse body
            relay = data.relays[0]
            running = if relay.r then "ja" else "nej"
            msg.send "#{relay.n} - #{service_url}#{relay.f} - körs: #{running}"
    
      robot.hear /^\.atlas( name)? (.*)/i, (msg) ->
        relay_summary(msg, atlas_url)
    
      robot.respond /atlas( name)? (.*)/i, (msg) ->
        relay_summary(msg, atlas_url)
    
      robot.hear /^\.globe( name)? (.*)/i, (msg) ->
        relay_summary(msg, globe_url)
    
      robot.respond /globe( name)? (.*)/i, (msg) ->
        relay_summary(msg, globe_url)
    
      # onion
      robot.hear /^\.oatlas( name)? (.*)/i, (msg) ->
        relay_summary(msg, onion_atlas_url)
    
      robot.respond /oatlas( name)? (.*)/i, (msg) ->
        relay_summary(msg, onion_atlas_url)
    
      robot.hear /^\.oglobe( name)? (.*)/i, (msg) ->
        relay_summary(msg, onion_globe_url)
    
      robot.respond /oglobe( name)? (.*)/i, (msg) ->
        relay_summary(msg, onion_globe_url)
    
      robot.hear /^\.dfri/i, (msg) ->
        msg.http(onionoo_url + "/summary?search=dfri&contact=dfri").get() (err, res, body) ->
    
            data = JSON.parse body
            relays = data.relays
    
            n_relays = relays.length
            n_running = 0
    
            for r in relays
              if r.r
                n_running++
    
            msg.send "#{n_running} av DFRI:s #{n_relays} Tor-relän verkar köras."