Secure Client for exposing TLS (aka SSL) secured services as plain-text connections locally, and for multiplexing a single port with multiple protocols using SNI
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

44 linhas
1.3 KiB

  1. /*
  2. sclient unwraps SSL.
  3. It makes secure remote connections (such as HTTPS) available locally as plain-text connections -
  4. similar to `stunnel` or `openssl s_client`.
  5. There are a variety of reasons that you might want to do that,
  6. but we created it specifically to be able to upgrade applications with legacy
  7. security protocols - like SSH, OpenVPN, and Postgres - to take
  8. advantage of the features of modern TLS, such as ALPN and SNI
  9. (which makes them routable through almost every type of firewall).
  10. See for more info.
  11. Package Basics
  12. In the simplest case you'll just be setting a ServerName and connection info:
  13. servername := ""
  14. sclient := &sclient.Tunnel{
  15. ServerName: servername,
  16. RemoteAddress: servername,
  17. RemotePort: 443,
  18. LocalAddress: "localhost",
  19. LocalPort: 3000,
  20. }
  21. err := sclient.DialAndListen()
  22. Try the CLI
  23. If you'd like to better understand what sclient does, you can try it out with `go run`:
  24. go get
  25. go run localhost:3000
  26. curl http://localhost:3000 -H "Host:"
  27. Pre-built versions for various platforms are also available at
  29. */
  30. package sclient