linter issue fixes
This commit is contained in:
1 parent
2f09c32d88
commit
c46003d882
2 files changed
+12
-13
No files matched your search
+11
-12
@@ -73,7 +73,7 @@ func InitProxies(locations []conf.Location) (map[string]func([]structure.Address
|
|||||||
}
|
}
|
||||||
|
|
||||||
func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
|
func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
|
||||||
for _, config := range configs {
|
for _, config := range configs { //nolint
|
||||||
ip := config.Address.IP
|
ip := config.Address.IP
|
||||||
|
|
||||||
for protocol, info := range config.HandlersInfo {
|
for protocol, info := range config.HandlersInfo {
|
||||||
@@ -98,7 +98,7 @@ func InitProxiesFromConfigs(configs structure.RoutingConfig) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getPathsFromEndpoints(endpoints []structure.EndpointDescriptor) []string {
|
func getPathsFromEndpoints(endpoints []structure.EndpointDescriptor) []string {
|
||||||
var paths []string
|
paths := make([]string, len(endpoints))
|
||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
paths = append(paths, endpoint.Path)
|
paths = append(paths, endpoint.Path)
|
||||||
}
|
}
|
||||||
@@ -125,20 +125,19 @@ func makeProxy(protocol string, skipAuth, skipExistCheck bool) (Proxy, error) {
|
|||||||
|
|
||||||
func Find(path string) (Proxy, string) {
|
func Find(path string) (Proxy, string) {
|
||||||
for _, item := range store {
|
for _, item := range store {
|
||||||
if item.pathPrefix == "" {
|
if item.pathPrefix != "" {
|
||||||
for _, iPath := range item.paths {
|
|
||||||
if path == iPath {
|
|
||||||
return item.proxy, path
|
|
||||||
}
|
|
||||||
if path == "/"+iPath {
|
|
||||||
return item.proxy, path[1:]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if strings.HasPrefix(path, item.pathPrefix) {
|
if strings.HasPrefix(path, item.pathPrefix) {
|
||||||
return item.proxy, getPathWithoutPrefix(path, item.pathPrefix)
|
return item.proxy, getPathWithoutPrefix(path, item.pathPrefix)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
for _, iPath := range item.paths {
|
||||||
|
if path == iPath {
|
||||||
|
return item.proxy, path
|
||||||
|
}
|
||||||
|
if path == "/"+iPath {
|
||||||
|
return item.proxy, path[1:]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return nil, ""
|
return nil, ""
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ func InitRoutes(configs structure.RoutingConfig) {
|
|||||||
AuthUserMethods = newAuthUserAddressMap
|
AuthUserMethods = newAuthUserAddressMap
|
||||||
}
|
}
|
||||||
|
|
||||||
func addEndpointsToMaps(endpoints []structure.EndpointDescriptor, newAddressMap map[string]bool, newInnerAddressMap map[string]bool, newAuthUserAddressMap map[string]bool) {
|
func addEndpointsToMaps(endpoints []structure.EndpointDescriptor, newAddressMap map[string]bool, newInnerAddressMap map[string]bool, newAuthUserAddressMap map[string]bool) { //nolint
|
||||||
for _, el := range endpoints {
|
for _, el := range endpoints {
|
||||||
newAddressMap[el.Path] = true
|
newAddressMap[el.Path] = true
|
||||||
if el.Inner {
|
if el.Inner {
|
||||||
|
|||||||
Reference in new issue
Block a user