Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add gateway support for HTTPS #213

Merged
merged 18 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
go fmt
  • Loading branch information
zhao committed Jul 17, 2021
commit 54cf04564ba7cdb7271dcc5ad1913fb4d067f9ca
2 changes: 1 addition & 1 deletion pkg/config/config_load.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func GetHttpConfig(cfg *model.Bootstrap) (err error) {
hc := &model.HttpConfig{}
if l.Config != nil {
if v, ok := l.Config.(map[string]interface{}); ok {
logger.Info("http config:" , v , ok)
logger.Info("http config:", v, ok)
switch l.Name {
case constant.DefaultHTTPType:
if err := mapstructure.Decode(v, hc); err != nil {
Expand Down
6 changes: 3 additions & 3 deletions pkg/model/base.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ var ProtocolTypeName = map[int32]string{

// ProtocolTypeValue
var ProtocolTypeValue = map[string]int32{
"HTTP": 0,
"TCP": 1,
"UDP": 2,
"HTTP": 0,
"TCP": 1,
"UDP": 2,
"HTTPS": 3,
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/model/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (bs *Bootstrap) ExistCluster(name string) bool {

// StaticResources
type StaticResources struct {
Listeners []*Listener `yaml:"listeners" json:"listeners" mapstructure:"listeners"`
Listeners []*Listener `yaml:"listeners" json:"listeners" mapstructure:"listeners"`
Clusters []*Cluster `yaml:"clusters" json:"clusters" mapstructure:"clusters"`
TimeoutConfig TimeoutConfig `yaml:"timeout_config" json:"timeout_config" mapstructure:"timeout_config"`
ShutdownConfig *ShutdownConfig `yaml:"shutdown_config" json:"shutdown_config" mapstructure:"shutdown_config"`
Expand Down
10 changes: 5 additions & 5 deletions pkg/model/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,16 @@ type HttpConfig struct {
ReadTimeoutStr string `json:"read_timeout,omitempty" yaml:"read_timeout,omitempty" mapstructure:"read_timeout"`
WriteTimeoutStr string `json:"write_timeout,omitempty" yaml:"write_timeout,omitempty" mapstructure:"write_timeout"`
MaxHeaderBytes int `json:"max_header_bytes,omitempty" yaml:"max_header_bytes,omitempty" mapstructure:"max_header_bytes"`
CertFile string `yaml:"cert_file" json:"cert_file" mapstructure:"cert_file"`
KeyFile string `yaml:"key_file" json:"key_file" mapstructure:"key_file"`
CertFile string `yaml:"cert_file" json:"cert_file" mapstructure:"cert_file"`
KeyFile string `yaml:"key_file" json:"key_file" mapstructure:"key_file"`
}

func MapInStruct(cfg interface{}) *HttpConfig {
var hc *HttpConfig
if cfg != nil {
if ok := mapstructure.Decode(cfg , &hc); ok != nil {
logger.Error("Config error" , ok)
if ok := mapstructure.Decode(cfg, &hc); ok != nil {
logger.Error("Config error", ok)
}
}
return hc
}
}
4 changes: 2 additions & 2 deletions pkg/pixiu/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func (l *ListenerService) httpsListener() {
}

logger.Infof("[dubbo-go-pixiu] httpsListener start at : %s", srv.Addr)
err := srv.ListenAndServeTLS(hc.CertFile , hc.KeyFile)
logger.Info("[dubbo-go-pixiu] httpsListener result:" , err)
err := srv.ListenAndServeTLS(hc.CertFile, hc.KeyFile)
logger.Info("[dubbo-go-pixiu] httpsListener result:", err)
}
func (l *ListenerService) httpListener() {
hl := NewDefaultHttpListener()
Expand Down