api

package module
v0.0.0-...-80ba7ae Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2019 License: MIT Imports: 15 Imported by: 0

README

grpc-http-shared-port

Demo of grpc.Server#ServeHTTP

This is a small demo of grpc.Server#ServeHTTP, which allows you to run a gRPC and non-gRPC HTTP server on the same port.

Installation
go get github.com/iredelmeier/grpc-http-shared-port
With TLS
go run h2/main.go
With TLS
go run h2c/main.go

Documentation

Index

Constants

View Source
const (
	Address = "localhost:56789"
)

Variables

View Source
var (
	Certificate = []byte(`-----BEGIN CERTIFICATE-----
MIIC/jCCAeagAwIBAgIJAPGpe7jZ+B9JMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
BAMMCWxvY2FsaG9zdDAeFw0xOTAxMDYwMzM5MDZaFw0yOTAxMDMwMzM5MDZaMBQx
EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
ggEBAMdmso6OeDGKvUvdW7n3pkht2G/QlsIf3VUcVGpM6gItoTgHmj/8I9LXAiKf
o1KVfQ7BfokI+DbKlUHfQ5Pa8thHIdOFV8XGRfJFfHxoZMGBVCwr/4NMBjBollfi
rBzqkdKsL9bQH8bmEmqJY2J5MUzg2gQaxhMCXWxDflFHpw7zmjHKaP13LSl0G3hF
zyxYPFb58k/3D2GjYy+zULXDLT9DCV9BfEXveKNJaDUy2OfmoDRDx/BGXxIdipzn
LgN4wr4gvSRPq3Jo/ElOcM7wguMgBRpCH/uKVZqLggHc9q2P+iCOZ6lqfpNNnfI8
LXqrwCFMv1K3Hx6Y4K2MwVDoVf8CAwEAAaNTMFEwHQYDVR0OBBYEFM3D5zeZf58b
UCtlLPsC3bqiNokXMB8GA1UdIwQYMBaAFM3D5zeZf58bUCtlLPsC3bqiNokXMA8G
A1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEtdLAuc/RryzzGMjLub
LHjAvBp9b16Fd7k/SJbI2qq4KIOh2PUC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xmZBH7un5rKS+iYBm4RIbThViBTNdA9LZp
JtwduIVwD40tLbQ+tOB65jb50iVMfE61rW8xchzOHYi13SaPgEjAXXysWLf+fVsy
C+1XqUHupFqvSHjFmgkC9Rcgu/6u6fri7N5sVlrt0llqvY0+VdREAadVAoGBANZ2
fwrXPEohMi3Aerv9qIyWuPKQyRRBS/fFUqllfhuXW74KcF4EoQCxOiSXBKjK1tgu
SfuJTaYCzzf7Knw3DpIs5HEVVMbG1Kgfbn7wDQTk7xloYub/vsgRZo9ez0HM+lxq
I62B4Y9/g3RRMmcTHXDWCw633ms29AAiMf32leADAoGBAJdYyXQuhIMoDMXBquOi
F693qTYJXb70OLch/DDe/sMwNHQK0Y/LfPIp09LFVp4mRBGAbfLvMsNyRrWA1OoX
i5hQkIbQaOcs/NowFRotd0R3MlKMd5ktUXgxbWaHH+qp2iMxQqjIQJ/cKK3g+taU
xJkJuj9HSaGhxbWyFVFLjOGhAoGALdsmbO36sSsJ7Kh0Vc/2AyGTKCJ3LEKN+MuT
Ui8mWMXzUt4uipvYxSof8YTs9R5x88VqAkOoe6+sGR82RVsMXYsFyXwzJVGMVOpr
mO7BCePdkAQ26YeThnnaARvXmw02Fx6GxGm6DhHIzM0zxsBaki7iLGJ6R1h3sbOe
FtxrzXsCgYEA0S0lYtmv4QOQq3mLf2lfroDCirqR6f5iXsyd3KhnkH/mnm56Bv4R
gTtaIFtkFS/s+lwNYSfQC/3uVPAbGcrZKRtmh9EaJk+jnjt72TRjldBnpxkXxGlz
svOxtwq93kqwiXrvckgvX+F/8D0fUpL0TyI5NY2qhPIT0tHW/yzSWiw=
-----END RSA PRIVATE KEY-----`)
)

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer() *Server

func (*Server) BlockUntilRunning

func (s *Server) BlockUntilRunning(timeout time.Duration) error

func (*Server) Serve

func (s *Server) Serve() error

func (*Server) ServeTLS

func (s *Server) ServeTLS() error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

func (*Server) TLSConfig

func (s *Server) TLSConfig() *tls.Config

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL