proxy

package
v1.2.2-dev.105 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2020 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Overview

******************************************************************************

  • Copyright 2019 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @author: Tingyu Zeng, Dell ******************************************************************************

******************************************************************************

  • Copyright 2019 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @author: Tingyu Zeng, Dell ******************************************************************************

******************************************************************************

  • Copyright 2019 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @author: Tingyu Zeng, Dell ******************************************************************************

******************************************************************************

  • Copyright 2019 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @author: Tingyu Zeng, Dell ******************************************************************************

******************************************************************************

  • Copyright 2019 Dell Inc. *
  • Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  • in compliance with the License. You may obtain a copy of the License at *
  • http://www.apache.org/licenses/LICENSE-2.0 *
  • Unless required by applicable law or agreed to in writing, software distributed under the License
  • is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  • or implied. See the License for the specific language governing permissions and limitations under
  • the License. *
  • @author: Tingyu Zeng, Dell ******************************************************************************

Index

Constants

View Source
const (
	ServicesPath     = "services"
	RoutesPath       = "routes"
	ConsumersPath    = "consumers"
	CertificatesPath = "certificates"
	PluginsPath      = "plugins"
	EdgeXKong        = "edgex-kong"
	VaultToken       = "X-Vault-Token"
	OAuth2GrantType  = "client_credentials"
	OAuth2Scopes     = "all"
)

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, cancel context.CancelFunc, _ *mux.Router, _ chan<- bool)

func NewRequestor

func NewRequestor(
	skipVerify bool,
	timeoutInSecond int,
	caCertPath string,
	lc logger.LoggingClient) internal.HttpCaller

Types

type Bootstrap

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

func NewBootstrap

func NewBootstrap(
	insecureSkipVerify bool,
	initNeeded bool,
	resetNeeded bool,
	userTobeCreated string,
	userOfGroup string,
	userToBeDeleted string) *Bootstrap

func (*Bootstrap) BootstrapHandler

func (b *Bootstrap) BootstrapHandler(_ context.Context, _ *sync.WaitGroup, _ startup.Timer, dic *di.Container) bool

BootstrapHandler fulfills the BootstrapHandler contract and performs initialization needed by the data service.

type CertError

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

func (*CertError) Error

func (ce *CertError) Error() string

type CertInfo

type CertInfo struct {
	Cert string   `json:"cert,omitempty"`
	Key  string   `json:"key,omitempty"`
	Snis []string `json:"snis,omitempty"`
}

type CertUploadErrorType

type CertUploadErrorType int
const (
	CertExisting  CertUploadErrorType = 0
	InternalError CertUploadErrorType = 1

	// AddProxyRoutesEnv is the environment variable name for adding the additional Kong routes for app services
	AddProxyRoutesEnv = "ADD_PROXY_ROUTE"
)

type Consumer

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

func NewConsumer

func NewConsumer(
	name string,
	r internal.HttpCaller,
	lc logger.LoggingClient,
	configuration *config.ConfigurationStruct) Consumer

func (*Consumer) AssociateWithGroup

func (c *Consumer) AssociateWithGroup(g string) error

func (*Consumer) Create

func (c *Consumer) Create(service string) error

func (*Consumer) CreateToken

func (c *Consumer) CreateToken() (string, error)

func (*Consumer) Delete

func (c *Consumer) Delete() error

type DataCollect

type DataCollect struct {
	Section []Item `json:"data"`
}

type Item

type Item struct {
	ID string `json:"id"`
}

type JWTCred

type JWTCred struct {
	ConsumerID string `json:"consumer_id,omitempty"`
	CreatedAt  int    `json:"created_at,omitempty"`
	ID         string `json:"id,omitempty"`
	Key        string `json:"key,omitempty"`
	Secret     string `json:"secret,omitempty"`
}

type KongACLPlugin

type KongACLPlugin struct {
	Name      string `url:"name"`
	WhiteList string `url:"config.whitelist"`
}

type KongBasicAuthPlugin

type KongBasicAuthPlugin struct {
	Name            string `url:"name,omitempty"`
	HideCredentials string `url:"config.hide_credentials,omitempty"`
}

type KongConsumerOauth2

type KongConsumerOauth2 struct {
	Name         string `url:"name,omitempty"`
	ClientID     string `url:"client_id,omitempty"`
	ClientSecret string `url:"client_secret,omitempty"`
	RedirectURIS string `url:"redirect_uris,omitempty"`
}

type KongJWTClaims

type KongJWTClaims struct {
	ISS  string `json:"iss"`
	Acct string `json:"account"`
	jwt.StandardClaims
}

type KongOAuth2Plugin

type KongOAuth2Plugin struct {
	Name                    string `url:"name"`
	Scope                   string `url:"config.scopes"`
	MandatoryScope          string `url:"config.mandatory_scope"`
	EnableClientCredentials string `url:"config.enable_client_credentials"`
	EnableGlobalCredentials string `url:"config.global_credentials"`
	TokenTTL                int    `url:"config.refresh_token_ttl"`
}

type KongOauth2Token

type KongOauth2Token struct {
	TokenType   string `json:"token_type"`
	AccessToken string `json:"access_token"`
	Expires     int    `json:"expires_in"`
}

type KongOuath2TokenRequest

type KongOuath2TokenRequest struct {
	ClientID     string `url:"client_id,omitempty"`
	ClientSecret string `url:"client_secret,omitempty"`
	GrantType    string `url:"grant_type,omitempty"`
	Scope        string `url:"scope,omitempty"`
}

type KongRoute

type KongRoute struct {
	Paths []string `json:"paths,omitempty"`
	Name  string   `json:"name,omitempty"`
}

type KongService

type KongService struct {
	Name     string `url:"name,omitempty"`
	Host     string `url:"host,omitempty"`
	Port     int    `url:"port,omitempty"`
	Protocol string `url:"protocol,omitempty"`
}

type KongServiceResponse

type KongServiceResponse struct {
	ID             string `json:"id,omitempty"`
	CreatedAt      uint64 `json:"created_at,omitempty"`
	UpdatedAt      uint64 `json:"updated_at,omitempty"`
	ConnectTimeout int64  `json:"connect_timeout,omitempty"`
	Protocol       string `json:"protocol,omitempty"`
	Host           string `json:"host,omitempty"`
	Port           uint64 `json:"port,omitempty"`
	Path           string `json:"path,omitempty"`
	Name           string `json:"name,omitempty"`
	Retries        int64  `json:"retries,omitempty"`
	ReadTimeout    int64  `json:"read_timeout,omitempty"`
	WriteTimeout   int64  `json:"write_timeout,omitempty"`
}

KongServiceResponse is the response from Kong when creating a service

type Resource

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

func NewResource

func NewResource(
	name string,
	r internal.HttpCaller,
	kongProxyBaseUrl string,
	lc logger.LoggingClient) *Resource

func (*Resource) Remove

func (r *Resource) Remove(path string) error

type Service

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

func NewService

func NewService(
	r internal.HttpCaller,
	lc logger.LoggingClient,
	configuration *config.ConfigurationStruct) Service

func (*Service) CheckProxyServiceStatus

func (s *Service) CheckProxyServiceStatus() error

func (*Service) CheckSecretServiceStatus

func (s *Service) CheckSecretServiceStatus() error

func (*Service) Init

func (*Service) ResetProxy

func (s *Service) ResetProxy() error

type UserTokenPair

type UserTokenPair struct {
	User  string
	Token string
}

func (*UserTokenPair) Save

func (ut *UserTokenPair) Save(w io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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