kjk / the-code Goto Github PK
View Code? Open in Web Editor NEWCode for my Go Cookbook articles
Home Page: https://blog.kowalczyk.info/book/go-cookbook.html
License: Other
Code for my Go Cookbook articles
Home Page: https://blog.kowalczyk.info/book/go-cookbook.html
License: Other
Hi.
on https://blog.kowalczyk.info/article/Jl3G/https-for-free-in-go-with-little-help-of-lets-encrypt.html
this link to code is broken- https://github.com/kjk/the-code/tree/master/free-ssl-certificates
Missing "/go" in path and should be https://github.com/kjk/the-code/tree/master/go/free-ssl-certificates
New to golang, so bare with me if I don't understand some parts correctly :)
03-live-progress-and-capture-v1.go looks wrong with regards to parallelism:
in line 47 the cmd is actually started, while only later two goroutines try to capture stdOut
and stdErr
.
Hence if your computer is slow or loaded, the cmd
is already finished and copyAndCapture
will fail to get a hold on anything.
If I add a simple time.Sleep(100 * time.Millisecond)
after the cmd.Start()
to simulate slowness, I get two error behaviours from time to time:
copyAndCapture
will fail to read (in line 19) but get an error read |0: file already closed
copyAndCapture
will miss the output (I didn't understand how that happens): the output is visible in my shell, but outStr
will be empty, hence no output from the captured stringNow this can be fixed in practice by shifting cmd.Start()
e.g. to line 56, after the goroutines were started. While that works in practice, I still think it's not absolutely correct as go probably doesn't guarantees when the actual code of a goroutine is executed, so while cmd.Start()
would appear later in the code, still copyAndCapture
might be executed "too late".
Hi,
I'm following the free-ssl-certificates
example, changed allowedHost
to mine, and it is working, at least for the http part. However, the https part is not working.
When the program starts, it prints on the console:
Starting HTTP server on 127.0.0.1:8080
Starting HTTPS server on :443
Is that normal? Shouldn't HTTPS server has an IP address as well?
Visiting http://127.0.0.1:8080 works fine, but when trying to visit https://127.0.0.1:443/, I'll get
This site can’t provide a secure connection
So,
allowedHost
, e.g., the httpPort
as well? If so, what to change to?thx
hey, I stumbled upon your article https://blog.kowalczyk.info/article/Jl3G/https-for-free-in-go-with-little-help-of-lets-encrypt.html
Is there any way to get publickey from cache? is it covered on your book?
and is publickey change when renewed after 3 month?
I'm following the free-ssl-certificates example, changed allowedHost to mine and httpPort
to :80
, and it is working, at least for the http part. However, the https part is not working.
When the program starts, it prints on the console:
Starting HTTP server on :80
Starting HTTPS server on :443
When using the https connection,
I'm getting
This site can’t be reached
site took too long to respond.
Checking back to the console, I see:
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40820: context deadline exceeded
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40826: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40828: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40822: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40830: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40832: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40860: acme/autocert: missing certificate
2019/05/07 11:11:11 http: TLS handshake error from 99.xx.xx.221:40824: acme/autocert: missing certificate
How to make it works? thx
Once again, I have a real site whose DNS name matches allowedHost. I've changed allowedHost to match, and it is working (by visiting my true DNS name) -- no complaining from the log, even with https.
Line 48 of the code prints the output and the error(if any) from the external command's result.
go-cookbook/advanced-exec/03-live-progress-and-capture-v3.go
But I see that the output is printed first.
Then again under "out:"
I couldn't understand which part of the code is printing the first output.
Using: go version go1.11.2 windows/amd64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.