Hello,
I’m very new to programming and golang.
I do have a problem I want to solve, that lead me to wondering about the below.
Yes I have a problem to solve, but here i am trying to understand the what and why of it all.
not find a work around.
I have a question, maybe someone can help me understand better.
I am trying to launch a webserver with TLS
using net.http
http.ListenAndServe(":443", certFile, keyFile, mux, )
in the above both certFile and KeyFIle are of type string
however for this to work they need to be of type (os *File)
(stat and lstat)
when you run ListenAndServerTLS( , cert, key, ,)
it will call x509.LoadKeyPair(certFile, keyFile)
passing the strings along from the original fucntion
then x509LKP will try to open those files and load their content, then pass it back up to the http.LaSTLS
MY question is why does this need to be an actual file?
in the end arent we really only needing an io.Reader{} interface?
Before you tell me this is an XY problem.
Yes i do have an actual problem i am trying to solve, which my cert.pem is not in a file form
additionally for trust chain to be proven (in the docs) I need to cat the CA and cert.pem
which again if not already in a single file
will require a mem based operation. Am I expected to write this to a new file just so http.ListenAndServeTLS can open again?
so yes I have a problem I am trying to solve, but also I am trying to understand
so one day I won;t be a go n00b