ngrok-wrapper 0.1.0

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.
data/enabled.yml ADDED
@@ -0,0 +1,122 @@
1
+ # These are all the cops that are enabled in the default configuration.
2
+
3
+ Layout/HashAlignment:
4
+ EnforcedColonStyle: table
5
+ EnforcedHashRocketStyle: table
6
+
7
+ Layout/EmptyLinesAroundAttributeAccessor:
8
+ Enabled: true
9
+
10
+ Layout/SpaceAroundMethodCallOperator:
11
+ Enabled: true
12
+
13
+ Lint/DeprecatedOpenSSLConstant:
14
+ Enabled: true
15
+
16
+ Lint/DuplicateElsifCondition:
17
+ Enabled: true
18
+
19
+ Lint/MixedRegexpCaptureTypes:
20
+ Enabled: true
21
+
22
+ Lint/RaiseException:
23
+ Enabled: true
24
+
25
+ Lint/StructNewOverride:
26
+ Enabled: true
27
+
28
+ Performance/AncestorsInclude:
29
+ Enabled: true
30
+
31
+ Performance/BigDecimalWithNumericArgument:
32
+ Enabled: true
33
+
34
+ Performance/RedundantSortBlock:
35
+ Enabled: true
36
+
37
+ Performance/RedundantStringChars:
38
+ Enabled: true
39
+
40
+ Performance/ReverseFirst:
41
+ Enabled: true
42
+
43
+ Performance/SortReverse:
44
+ Enabled: true
45
+
46
+ Performance/Squeeze:
47
+ Enabled: true
48
+
49
+ Performance/StringInclude:
50
+ Enabled: true
51
+
52
+ Style/AccessorGrouping:
53
+ Enabled: true
54
+ EnforcedStyle: grouped
55
+
56
+ Style/ArrayCoercion:
57
+ Enabled: true
58
+
59
+ Style/AutoResourceCleanup:
60
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
61
+ Enabled: true
62
+
63
+ Style/BisectedAttrAccessor:
64
+ Enabled: true
65
+
66
+ Style/CaseLikeIf:
67
+ Enabled: true
68
+
69
+ Style/CollectionMethods:
70
+ Description: 'Preferred collection methods.'
71
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size'
72
+ Enabled: true
73
+
74
+ Style/ExponentialNotation:
75
+ Enabled: true
76
+ EnforcedStyle: scientific
77
+
78
+ Style/HashAsLastArrayItem:
79
+ Enabled: true
80
+ EnforcedStyle: no_braces
81
+
82
+ Style/HashEachMethods:
83
+ Enabled: true
84
+
85
+ Style/HashLikeCase:
86
+ Enabled: true
87
+ MinBranchesCount: 3
88
+
89
+ Style/HashTransformKeys:
90
+ Enabled: true
91
+
92
+ Style/HashTransformValues:
93
+ Enabled: true
94
+
95
+ Style/RedundantAssignment:
96
+ Enabled: true
97
+
98
+ Style/RedundantFetchBlock:
99
+ Enabled: true
100
+ SafeForConstants: false
101
+
102
+ Style/RedundantFileExtensionInRequire:
103
+ Enabled: true
104
+
105
+ Style/RedundantRegexpCharacterClass:
106
+ Enabled: true
107
+
108
+ Style/RedundantRegexpEscape:
109
+ Enabled: true
110
+
111
+ Style/Send:
112
+ Description: 'Prefer `Object#__send__` or `Object#public_send` to `send`, as `send` may overlap with existing methods.'
113
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#prefer-public-send'
114
+ Enabled: true
115
+
116
+ Style/SlicingWithRange:
117
+ Enabled: true
118
+
119
+ Style/StringMethods:
120
+ Enabled: true
121
+ PreferredMethods:
122
+ intern: to_sym
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ngrok
4
+ class Wrapper
5
+ VERSION = '0.1.0'
6
+ end
7
+ end
@@ -0,0 +1,196 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'wrapper/version'
4
+ require 'tempfile'
5
+
6
+ module Ngrok
7
+ OPTIONAL_PARAMS = %i[authtoken bind_tls host_header hostname inspect region subdomain].freeze
8
+
9
+ class NotFound < StandardError; end
10
+ class FetchUrlError < StandardError; end
11
+ class Error < StandardError; end
12
+
13
+ class Wrapper
14
+ class << self
15
+ attr_reader :pid, :ngrok_url, :ngrok_url_https, :status, :params
16
+
17
+ def init(params = {})
18
+ # map old key 'port' to 'addr' to maintain backwards compatibility with versions 2.0.21 and earlier
19
+ params[:addr] = params.delete(:port) if params.key?(:port)
20
+
21
+ @params = { addr: 3001, timeout: 10, config: '/dev/null' }.merge!(params)
22
+ @status ||= :stopped # rubocop:disable Naming/MemoizedInstanceVariableName
23
+ end
24
+
25
+ def start(params = {})
26
+ ensure_binary
27
+ init(params)
28
+
29
+ persistent_ngrok = @params[:persistence] == true
30
+ # Attempt to read the attributes of an existing process instead of starting a new process.
31
+ try_params_from_running_ngrok if persistent_ngrok
32
+
33
+ spawn_new_ngrok(persistent_ngrok: persistent_ngrok) if stopped?
34
+
35
+ @status = :running
36
+ if persistent_ngrok
37
+ # Record the attributes of the new process so that it can be reused on a subsequent call.
38
+ File.write(@persistence_file, { pid: @pid, ngrok_url: @ngrok_url, ngrok_url_https: @ngrok_url_https }.to_json)
39
+ end
40
+
41
+ @ngrok_url
42
+ end
43
+
44
+ def stop
45
+ if running?
46
+ Process.kill(9, @pid)
47
+ @ngrok_url = @ngrok_url_https = @pid = nil
48
+ @status = :stopped
49
+ end
50
+ @status
51
+ end
52
+
53
+ def running?
54
+ @status == :running
55
+ end
56
+
57
+ def stopped?
58
+ @status == :stopped
59
+ end
60
+
61
+ def addr
62
+ @params[:addr]
63
+ end
64
+
65
+ def port
66
+ return addr if addr.is_a?(Numeric)
67
+
68
+ addr.split(':').last.to_i
69
+ end
70
+
71
+ def inherited(subclass)
72
+ super
73
+ init
74
+ end
75
+
76
+ private
77
+
78
+ def parse_persistence_file
79
+ JSON.parse(File.read(@persistence_file))
80
+ rescue StandardError => _e # Catch all possible errors on reading and parsing the file
81
+ nil
82
+ end
83
+
84
+ def raise_if_similar_ngroks(pid)
85
+ other_ngrok_on_port = ngrok_process_status_lines.find do |line|
86
+ # If found an Ngrok process with other pid, tunneling on the port, specified in Ngrok::Wrapper.start params
87
+ line.include?('ngrok http -log') && !line.start_with?(pid || '') && line.end_with?(addr.to_s)
88
+ end
89
+
90
+ raise Ngrok::Error, "ERROR: Other ngrok instances tunneling to port #{addr} found" if other_ngrok_on_port
91
+
92
+ return unless pid
93
+
94
+ tunnel_on_other_port = ngrok_process_status_lines.find do |line|
95
+ # If the line starts with this pid, but the port is other than specified in Ngrok::Wrapper.start params
96
+ line.include?('ngrok http -log') && line.start_with?(pid) && !line.end_with?(addr.to_s)
97
+ end
98
+
99
+ return unless tunnel_on_other_port
100
+
101
+ raise Ngrok::Error, "ERROR: Ngrok pid ##{pid} tunneling on other port #{tunnel_on_other_port.split(':').last}"
102
+ end
103
+
104
+ def ngrok_process_status_lines(refetch: false)
105
+ return @ngrok_process_status_lines if defined?(@ngrok_process_status_lines) && !refetch
106
+
107
+ @ngrok_process_status_lines = (`ps ax | grep "ngrok http"`).split("\n")
108
+ end
109
+
110
+ def try_params_from_running_ngrok
111
+ @persistence_file = @params[:persistence_file] || "#{File.dirname(@params[:config])}/ngrok-process.json"
112
+ state = parse_persistence_file
113
+ return unless (pid = state&.[]('pid'))
114
+
115
+ raise_if_similar_ngroks(pid)
116
+
117
+ return unless ngrok_running?(pid)
118
+
119
+ @status = :running
120
+ @pid = pid
121
+ @ngrok_url = state['ngrok_url']
122
+ @ngrok_url_https = state['ngrok_url_https']
123
+ end
124
+
125
+ def ngrok_running?(pid)
126
+ ngrok_process_status_lines.find do |line|
127
+ # If found the Ngrok process with correct pid, tunneling on the port, specified in Ngrok::Wrapper.start params
128
+ line.include?('ngrok http -log') && line.start_with?(pid) && line.end_with?(addr.to_s)
129
+ end
130
+ end
131
+
132
+ def spawn_new_ngrok(persistent_ngrok:)
133
+ raise_if_similar_ngroks(nil)
134
+ # Prepare the log file into which ngrok output will be redirected in `ngrok_exec_params`
135
+ @params[:log] = @params[:log] ? File.open(@params[:log], 'w+') : Tempfile.new('ngrok')
136
+ if persistent_ngrok
137
+ Process.spawn("exec nohup ngrok http #{ngrok_exec_params} &")
138
+ @pid = ngrok_process_status_lines(refetch: true)
139
+ .find { |line| line.include?('ngrok http -log') && line.end_with?(addr.to_s) }.split[0]
140
+ else
141
+ @pid = Process.spawn("exec ngrok http #{ngrok_exec_params}")
142
+ at_exit { Ngrok::Wrapper.stop }
143
+ end
144
+
145
+ fetch_urls
146
+ end
147
+
148
+ def ngrok_exec_params
149
+ exec_params = +'-log=stdout -log-level=debug '
150
+ OPTIONAL_PARAMS.each do |opt|
151
+ exec_params << "-#{opt.to_s.tr('_', '-')}=#{@params[opt]} " if @params.key?(opt)
152
+ end
153
+ exec_params << "-config #{@params[:config]} #{@params[:addr]} > #{@params[:log].path}"
154
+ end
155
+
156
+ def fetch_urls
157
+ @params[:timeout].times do
158
+ break if scan_log_for_urls || !@error.empty?
159
+
160
+ sleep 1
161
+ @params[:log].rewind
162
+ end
163
+
164
+ @params[:log].close
165
+ return if @ngrok_url || @ngrok_url_https
166
+
167
+ stop
168
+ raise FetchUrlError, 'Unable to fetch external url' if @error.empty?
169
+
170
+ raise Ngrok::Error, @error.first
171
+ end
172
+
173
+ def scan_log_for_urls
174
+ log_content = @params[:log].read
175
+ result = log_content.scan(/URL:(.+)\sProto:(http|https)\s/)
176
+ unless result.empty?
177
+ result = Hash[*result.flatten].invert
178
+ @ngrok_url = result['http']
179
+ @ngrok_url_https = result['https']
180
+ return true if @ngrok_url || @ngrok_url_https
181
+ end
182
+
183
+ @error = log_content.scan(/msg="command failed" err="([^"]+)"/).flatten
184
+ false
185
+ end
186
+
187
+ def ensure_binary
188
+ `ngrok version`
189
+ rescue Errno::ENOENT
190
+ raise Ngrok::NotFound, 'Ngrok binary not found'
191
+ end
192
+ end
193
+
194
+ init
195
+ end
196
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = "#{__dir__}/lib"
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+
6
+ require_relative 'lib/ngrok/wrapper/version'
7
+
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'ngrok-wrapper'
10
+ spec.version = Ngrok::Wrapper::VERSION
11
+ spec.authors = ['Anton Bogdanovich', 'Aureliu Brinzeanu']
12
+ spec.email = %w[27bogdanovich@gmail.com branzeanu.aurel@gmail.com]
13
+
14
+ spec.summary = 'Ngrok-wrapper gem is a ruby wrapper for ngrok2'
15
+ spec.description = 'Ngrok-wrapper gem is a ruby wrapper for ngrok2'
16
+ spec.homepage = 'https://github.com/texpert/ngrok-wrapper'
17
+ spec.required_ruby_version = '>= 2.6.0'
18
+ spec.license = 'MIT'
19
+
20
+ spec.metadata['rubygems_mfa_required'] = 'true'
21
+ spec.metadata['homepage_uri'] = spec.homepage
22
+ spec.metadata['source_code_uri'] = 'https://github.com/texpert/ngrok-wrapper'
23
+ spec.metadata['changelog_uri'] = 'https://github.com/texpert/ngrok-wrapper/blob/main/CHANGELOG.md'
24
+
25
+ # Specify which files should be added to the gem when it is released.
26
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
27
+ spec.files = `git ls-files -z`.split("\x0")
28
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_development_dependency 'github_changelog_generator'
32
+ spec.add_development_dependency 'rake'
33
+ spec.add_development_dependency 'rspec'
34
+ spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'rubocop-performance'
36
+ spec.add_development_dependency 'rubocop-rspec'
37
+ end
@@ -0,0 +1,6 @@
1
+ module Ngrok
2
+ module Wrapper
3
+ VERSION: String
4
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
+ end
6
+ end
@@ -0,0 +1,43 @@
1
+ t=2022-01-08T22:03:24+0200 lvl=info msg="open config file" path=/Users/thunder/.ngrok2/ngrok.yml err=nil
2
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=vendor.svg ext=.svg
3
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=glyphicons-halflings-regular.svg ext=.svg
4
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="starting component" obj=app name="signal handler"
5
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="starting component" obj=app name="Tunnel session"
6
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="starting component" obj=app name=web
7
+ t=2022-01-08T22:03:24+0200 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040
8
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="starting component" obj=app name=updater
9
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="checking for updates periodically" obj=updater interval=6h0m0s
10
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="check for update" obj=updater
11
+ t=2022-01-08T22:03:24+0200 lvl=info msg=start pg=/grpc/agent.Web/State id=f491cd33fec883bf
12
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="open stream" obj=csess id=bee4588e8c6f reqtype=0 err=nil
13
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="encode request" obj=csess id=bee4588e8c6f sid=3 req="&{Version:[2] ClientID: Extra:{OS:darwin Arch:amd64 Authtoken: Version:2.3.40 Hostname:tunnel.us.ngrok.com UserAgent:ngrok/2 Metadata: Cookie: HeartbeatInterval:10000000000 HeartbeatTolerance:15000000000 Fingerprint:0xc000442c30 UpdateUnsupportedError:0xc0000a52f0 StopUnsupportedError:0xc0000a52e0 RestartUnsupportedError:0xc0000a52d0}}" err=nil
14
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="decoded response" obj=csess id=bee4588e8c6f sid=3 resp="&{Version:2 ClientID:cb5f5f87e10e18bf4898de4a3a74d14b Error: Extra:{Version:prod Cookie:PrKmFyxHID0adtX44ErfI+A9gur8/kWa$S+hD0y1YuDXBOgvRysUB4wPAqfDnq8qBKSCKIvenBxXk8d0mM20jXvewiT5y+PSeMJ1ev6wrxFlrMho0T2AkG/39mF0QxTCWNgCYrrSK4Q+fRyr7I+7477gVIbVN7HZ0hhaqUK0BFFvIXea531lwDg88oqrW0nvjBqyL1vw3rqowuUc6TB+9+Pc2CPxBY9sERlcvOYkzVSR4bn0mlTG0vBI= AccountName: SessionDuration:7199 PlanName:}}" err=nil
15
+ t=2022-01-08T22:03:24+0200 lvl=info msg="tunnel session started" obj=tunnels.session
16
+ t=2022-01-08T22:03:24+0200 lvl=info msg="client session established" obj=csess id=bd4add4fa19a
17
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="open stream" obj=csess id=bee4588e8c6f clientid=cb5f5f87e10e18bf4898de4a3a74d14b reqtype=1 err=nil
18
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="encode request" obj=csess id=bee4588e8c6f clientid=cb5f5f87e10e18bf4898de4a3a74d14b sid=7 req="&{ID: ClientID: Proto:https Opts:0xc0000c4780 Extra:{Token: IPPolicyRef: Metadata:}}" err=nil
19
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="decoded response" obj=csess id=bee4588e8c6f clientid=cb5f5f87e10e18bf4898de4a3a74d14b sid=7 resp="&{ClientID: URL: Proto: Opts:<nil> Error:Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n Extra:{Token:}}" err=nil
20
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="start tunnel listen" obj=tunnels.session name=command_line proto=https opts="&{Hostname: Auth: Subdomain: HostHeaderRewrite:false LocalURLScheme:https}" err="Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n"
21
+ t=2022-01-08T22:03:24+0200 lvl=eror msg="session closing" obj=tunnels.session err="Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n"
22
+ t=2022-01-08T22:03:24+0200 lvl=info msg="accept failed" obj=csess id=bd4add4fa19a err="reconnecting session closed"
23
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="component stopped" obj=app name="Tunnel session" err="Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n"
24
+ t=2022-01-08T22:03:24+0200 lvl=info msg="received stop request" obj=app stopReq="{err:0xc0000a5980 restart:false}"
25
+ t=2022-01-08T22:03:24+0200 lvl=eror msg="terminating with error" obj=app err="Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n"
26
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="tunnel session closing permanently" obj=tunnels.session err="not reconnecting, session closed by the client side"
27
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="waiting for all components to stop" obj=app
28
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=3
29
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=2
30
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=1
31
+ t=2022-01-08T22:03:24+0200 lvl=warn msg="failed to check for update" obj=updater err="Post \"https://update.equinox.io/check\": context canceled"
32
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="component stopped" obj=app name=web err=nil
33
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="all components stopped" obj=app
34
+ t=2022-01-08T22:03:24+0200 lvl=crit msg="command failed" err="Forwarding to local port 443 or a local https:// URL is only available after you sign up.\nSign up at: https://dashboard.ngrok.com/signup\n\nIf you have already signed up, make sure your authtoken is installed.\nYour authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_340\r\n"
35
+ Forwarding to local port 443 or a local https:// URL is only available after you sign up.
36
+ Sign up at: https://dashboard.ngrok.com/signup
37
+
38
+ If you have already signed up, make sure your authtoken is installed.
39
+ Your authtoken is available on your dashboard: https://dashboard.ngrok.com/get-started/your-authtoken
40
+
41
+ ERR_NGROK_340
42
+
43
+ t=2022-01-08T22:03:24+0200 lvl=dbug msg="component stopped" obj=app name="signal handler" err=nil
@@ -0,0 +1,34 @@
1
+ t=2022-01-08T20:02:00+0200 lvl=info msg="open config file" path=/Users/thunder/.ngrok2/ngrok.yml err=nil
2
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=glyphicons-halflings-regular.svg ext=.svg
3
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=vendor.svg ext=.svg
4
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="starting component" obj=app name="signal handler"
5
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="starting component" obj=app name=web
6
+ t=2022-01-08T20:02:00+0200 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040
7
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="starting component" obj=app name="Tunnel session"
8
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="starting component" obj=app name=updater
9
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="checking for updates periodically" obj=updater interval=6h0m0s
10
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="check for update" obj=updater
11
+ t=2022-01-08T20:02:00+0200 lvl=info msg=start pg=/grpc/agent.Web/State id=2bbbb902480eaf60
12
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="open stream" obj=csess id=722767b16fd7 reqtype=0 err=nil
13
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="encode request" obj=csess id=722767b16fd7 sid=3 req="&{Version:[2] ClientID: Extra:{OS:darwin Arch:amd64 Authtoken:1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaRPETc Version:2.3.40 Hostname:tunnel.us.ngrok.com UserAgent:ngrok/2 Metadata: Cookie: HeartbeatInterval:10000000000 HeartbeatTolerance:15000000000 Fingerprint:0xc0005870b0 UpdateUnsupportedError:0xc0005827e0 StopUnsupportedError:0xc0005827d0 RestartUnsupportedError:0xc0005827c0}}" err=nil
14
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="decoded response" obj=csess id=722767b16fd7 sid=3 resp="&{Version:2 ClientID:09923e94929a0b5a25d01d204db8551f Error: Extra:{Version:prod Cookie:HGyjNiaHRPD5FZZ20HIeXaor2I1gELo/$exvZVPin7bk5uy7IStEyr6OD2XJrjatWDP7lRkBf+FuF6IxTsZd+x4npcaHKgRd86EF333l9Ye1Jf/67xcyHtnuQRRRmrtwuBh6s+xIdZEapgYm2+Z7yrXYakItFsvF5V95skLAkOZPfcoYPuo/wJB0oVCbPg1B7KkwB7QhBEUeKysIpzZTY1ZdYp+EWodIiujo6umhCzQaf3XPlHzQ= AccountName:Aurel Brinzeanu SessionDuration:0 PlanName:Free}}" err=nil
15
+ t=2022-01-08T20:02:00+0200 lvl=info msg="tunnel session started" obj=tunnels.session
16
+ t=2022-01-08T20:02:00+0200 lvl=info msg="client session established" obj=csess id=2528230e5df5
17
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="open stream" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f reqtype=1 err=nil
18
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="encode request" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f sid=7 req="&{ID: ClientID: Proto:https Opts:0xc00071a690 Extra:{Token: IPPolicyRef: Metadata:}}" err=nil
19
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="decoded response" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f sid=7 resp="&{ClientID:5dd5645be0454d6f8a1dc5f9130a6d1b URL:https://b1cd-109-185-141-9.ngrok.io Proto:https Opts:map[Auth: BasicAuth:<nil> CircuitBreaker:<nil> Compression:<nil> HostHeaderRewrite:false Hostname:b1cd-109-185-141-9.ngrok.io IPRestriction:<nil> LocalURLScheme:https MutualTLSCA:<nil> OAuth:<nil> ProxyProto:0 RequestHeaders:<nil> ResponseHeaders:<nil> Subdomain: WebhookVerification:<nil> WebsocketTCPConverter:<nil>] Error: Extra:{Token:L+C5Xuf2F8JjA2o8cloUX4NwcMTUo4l0$CkYDAnj+Dm17nYZ1/H/o5wuzNHWDUZqJHU6Omj61l0hf9C3KZ0wtrIDGe9W03+syfaQjYP1UL/BQwxEGReR5UHJpCFUtSmK87vIHrKCsQMnE9Z74FwIKNKXDv59LGSy83OcLyeFvx5GhbqpACeWGJ9u/5nBAG86UP2fAGHCiUYcdmRwpNfygjv/MQazbMAe54YqPn1ZzonDXZy7Lzo9gWUDHqkpuLITDhmEW6RIgz311QpIMRSHb6kfZ2nmfXAZz/2exRPMe9uAYuffJK+zIwX/E3kKCXflrd9+ZJ7cw6Eiaroa5SRl0Tixsp9eWEWl9bn7+ubIfO7lSqd2mDRUKWhm0JgAZJIcGrwL9JZ2EKxgXABoGVKyJ89BJfY+Ok9W1leVxHQ+P1DERjHD8Hxp+MfHCa+fqFxM3UObs2MV0j3DZ7ReengLdamok39Z4yXwjIxxfGyGo86Di9bRDpQKgP49/wdvn4qOdLq9hIrWFqkkP/fGr2Hz3hIwGmjY0xC2Zr9ha7Ik+FoFe4tvhRVinZC9TdrnfkY1wdx2Xel5iAsG13k31FtUdCmzPaRnYBAhxn4xDhX10blULXiE=}}" err=nil
20
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="start tunnel listen" obj=tunnels.session name=command_line proto=https opts="&{Hostname: Auth: Subdomain: HostHeaderRewrite:false LocalURLScheme:https}" err=nil
21
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="open stream" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f reqtype=1 err=nil
22
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="encode request" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f sid=9 req="&{ID: ClientID: Proto:http Opts:0xc00091a0f0 Extra:{Token: IPPolicyRef: Metadata:}}" err=nil
23
+ t=2022-01-08T20:02:00+0200 lvl=dbug msg="no update available" obj=updater
24
+ t=2022-01-08T20:02:01+0200 lvl=dbug msg="decoded response" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f sid=9 resp="&{ClientID:bbde46c7c553a50d47e73f8ed2a5f94f URL:http://b1cd-109-185-141-9.ngrok.io Proto:http Opts:map[Auth: BasicAuth:<nil> CircuitBreaker:<nil> Compression:<nil> HostHeaderRewrite:false Hostname:b1cd-109-185-141-9.ngrok.io IPRestriction:<nil> LocalURLScheme:https MutualTLSCA:<nil> OAuth:<nil> ProxyProto:0 RequestHeaders:<nil> ResponseHeaders:<nil> Subdomain: WebhookVerification:<nil> WebsocketTCPConverter:<nil>] Error: Extra:{Token:ulvkj4ZPhRugBcDpoJTiDaWlhFBKSJje$pNXpffDJJ1LGn6FfYcksW+hS6eaJBI9Ia1e3QkA18EPjQJgH7DTumRRsx/XBXkONc/hK38y5W4pQ6bOwBvKg8Nxf5HJltbvgcTH+Spxitf1/6+LzA8LGX0L6kHS7+sdtshfD8j3CFb1sds1AaP0ZJcxBNLHuALiWLV7VvK1GCas77PydCivnsToPNz35Y8SENtT2w1Ws3d9O55udnDyvrqF5VVLgYkc4jq1NHxbuEETulgva1q6svMX304dIS6H+93PRsAxKwdc/4sMhTCC1e5uYqP639iMlHKoZ9f+vA8pI7jLB+A05s4NapGwfmDeyNyjlu7s8X37VMUlMV49ETWIw71PhhXnT7ydwclxnUy28TGDiiZ/9DIdcmEO5EZulFh4QRfL3WlsAWsvbvpjCUUmJI6ZPwmvfw9nTob+cShTuaDWyFjahk+PgSzisrALFHGuUlyf93YfSA1GzYvofp24UBz5DjfezYx3kC2g6sRkJfKX3KvPgP/pjQhVyRywp7bUEBT7u3EvGh+dy77Nw7+dTpqFRFAOB55go1GvuKdt6vv816xt6FuzRAti13DkVWMxcUfufGULpeA==}}" err=nil
25
+ t=2022-01-08T20:02:01+0200 lvl=dbug msg="start tunnel listen" obj=tunnels.session name="command_line (http)" proto=http opts="&{Hostname:b1cd-109-185-141-9.ngrok.io Auth: Subdomain: HostHeaderRewrite:false LocalURLScheme:https}" err=nil
26
+ t=2022-01-08T20:02:01+0200 lvl=info msg="started tunnel" obj=tunnels name="command_line (http)" addr=https://localhost:3000 url=http://b1cd-109-185-141-9.ngrok.io
27
+ t=2022-01-08T20:02:01+0200 lvl=info msg="started tunnel" obj=tunnels name=command_line addr=https://localhost:3000 url=https://b1cd-109-185-141-9.ngrok.io
28
+ t=2022-01-08T20:02:01+0200 lvl=info msg=start pg=/grpc/agent.Web/State id=e7293c8805b32c56
29
+ t=2022-01-08T20:02:10+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=446
30
+ t=2022-01-08T20:02:21+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=149
31
+ t=2022-01-08T20:02:31+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=155
32
+ t=2022-01-08T20:02:41+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=151
33
+ t=2022-01-08T20:02:51+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=150
34
+ t=2022-01-08T20:03:01+0200 lvl=dbug msg="heartbeat received" obj=csess id=722767b16fd7 clientid=09923e94929a0b5a25d01d204db8551f latency_ms=149
@@ -0,0 +1,37 @@
1
+ t=2022-01-08T22:01:24+0200 lvl=info msg="open config file" path=/Users/thunder/.ngrok2/ngrok.yml err=nil
2
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=glyphicons-halflings-regular.svg ext=.svg
3
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="ignoring manifest file with unhandled mimetype" name=vendor.svg ext=.svg
4
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="starting component" obj=app name=web
5
+ t=2022-01-08T22:01:24+0200 lvl=info msg="starting web service" obj=web addr=127.0.0.1:4040
6
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="starting component" obj=app name=updater
7
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="starting component" obj=app name="signal handler"
8
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="starting component" obj=app name="Tunnel session"
9
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="checking for updates periodically" obj=updater interval=6h0m0s
10
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="check for update" obj=updater
11
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="open stream" obj=csess id=a09f6c909db5 reqtype=0 err=nil
12
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="encode request" obj=csess id=a09f6c909db5 sid=3 req="&{Version:[2] ClientID: Extra:{OS:darwin Arch:amd64 Authtoken:1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR Version:2.3.40 Hostname:tunnel.us.ngrok.com UserAgent:ngrok/2 Metadata: Cookie: HeartbeatInterval:10000000000 HeartbeatTolerance:15000000000 Fingerprint:0xc000438900 UpdateUnsupportedError:0xc000283190 StopUnsupportedError:0xc000283180 RestartUnsupportedError:0xc000283170}}" err=nil
13
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="decoded response" obj=csess id=a09f6c909db5 sid=3 resp="&{Version: ClientID: Error:The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n Extra:{Version: Cookie: AccountName: SessionDuration:0 PlanName:}}" err=nil
14
+ t=2022-01-08T22:01:24+0200 lvl=eror msg="failed to auth" obj=tunnels.session err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
15
+ t=2022-01-08T22:01:24+0200 lvl=eror msg="failed to reconnect session" obj=csess id=49b66f54e43d err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
16
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="sleep before reconnect" obj=csess id=49b66f54e43d secs=0
17
+ t=2022-01-08T22:01:24+0200 lvl=eror msg="session closing" obj=tunnels.session err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
18
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="component stopped" obj=app name="Tunnel session" err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
19
+ t=2022-01-08T22:01:24+0200 lvl=info msg="received stop request" obj=app stopReq="{err:0xc0000a5ad0 restart:false}"
20
+ t=2022-01-08T22:01:24+0200 lvl=eror msg="terminating with error" obj=app err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
21
+ t=2022-01-08T22:01:24+0200 lvl=warn msg="failed to check for update" obj=updater err="Post \"https://update.equinox.io/check\": context canceled"
22
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="waiting for all components to stop" obj=app
23
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=3
24
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=2
25
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="waiting for components to stop" obj=app remaining=1
26
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="component stopped" obj=app name=updater err=nil
27
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="component stopped" obj=app name="signal handler" err=nil
28
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="all components stopped" obj=app
29
+ t=2022-01-08T22:01:24+0200 lvl=crit msg="command failed" err="The authtoken you specified does not look like a proper ngrok tunnel authtoken.\nYour authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR\nInstructions to install your authtoken are on your ngrok dashboard:\nhttps://dashboard.ngrok.com/get-started/your-authtoken\r\n\r\nERR_NGROK_105\r\n"
30
+ The authtoken you specified does not look like a proper ngrok tunnel authtoken.
31
+ Your authtoken: 1gsJ49S2XCIOZM5AMynyeht9w8X_5ABZ98sjGeNwNHDaR
32
+ Instructions to install your authtoken are on your ngrok dashboard:
33
+ https://dashboard.ngrok.com/get-started/your-authtoken
34
+
35
+ ERR_NGROK_105
36
+
37
+ t=2022-01-08T22:01:24+0200 lvl=dbug msg="component stopped" obj=app name=web err=nil