github.com/polarismesh/polaris@v1.17.8/common/utils/const.go (about) 1 /** 2 * Tencent is pleased to support the open source community by making Polaris available. 3 * 4 * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. 5 * 6 * Licensed under the BSD 3-Clause License (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * https://opensource.org/licenses/BSD-3-Clause 11 * 12 * Unless required by applicable law or agreed to in writing, software distributed 13 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 14 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 15 * specific language governing permissions and limitations under the License. 16 */ 17 18 package utils 19 20 const ( 21 // PolarisCode polaris code 22 PolarisCode = "X-Polaris-Code" 23 // PolarisMessage polaris message 24 PolarisMessage = "X-Polaris-Message" 25 // PolarisRequestID request_id 26 PolarisRequestID = "Request-Id" 27 ) 28 29 var ( 30 // LocalHost local host 31 LocalHost = "127.0.0.1" 32 // LocalPort default listen port 33 LocalPort = 8091 34 // ConfDir default config dir 35 ConfDir = "conf/" 36 ) 37 38 const ( 39 // HeaderAuthTokenKey auth token key 40 HeaderAuthTokenKey string = "X-Polaris-Token" 41 // HeaderIsOwnerKey is owner key 42 HeaderIsOwnerKey string = "X-Is-Owner" 43 // HeaderUserIDKey user id key 44 HeaderUserIDKey string = "X-User-ID" 45 // HeaderOwnerIDKey owner id key 46 HeaderOwnerIDKey string = "X-Owner-ID" 47 // HeaderUserRoleKey user role key 48 HeaderUserRoleKey string = "X-Polaris-User-Role" 49 50 // ContextAuthTokenKey auth token key 51 ContextAuthTokenKey = StringContext(HeaderAuthTokenKey) 52 // ContextIsOwnerKey is owner key 53 ContextIsOwnerKey = StringContext(HeaderIsOwnerKey) 54 // ContextUserIDKey user id key 55 ContextUserIDKey = StringContext(HeaderUserIDKey) 56 // ContextOwnerIDKey owner id key 57 ContextOwnerIDKey = StringContext(HeaderOwnerIDKey) 58 // ContextUserRoleIDKey user role key 59 ContextUserRoleIDKey = StringContext(HeaderUserRoleKey) 60 // ContextAuthContextKey auth context key 61 ContextAuthContextKey = StringContext("X-Polaris-AuthContext") 62 // ContextUserNameKey users name key 63 ContextUserNameKey = StringContext("X-User-Name") 64 // ContextClientAddress client address key 65 ContextClientAddress = StringContext("client-address") 66 // ContextOpenAsyncRegis open async register key 67 ContextOpenAsyncRegis = StringContext("client-asyncRegis") 68 // ContextGrpcHeader grpc header key 69 ContextGrpcHeader = StringContext("grpc-header") 70 // ContextIsFromClient is from client 71 ContextIsFromClient = StringContext("from-client") 72 // ContextIsFromSystem is from polaris system 73 ContextIsFromSystem = StringContext("from-system") 74 // ContextOperator operator info 75 ContextOperator = StringContext("operator") 76 ) 77 78 const ( 79 // EmptyErrString empty error string 80 EmptyErrString = "empty" 81 // NilErrString null pointer error string 82 NilErrString = "nil" 83 // MatchAll rule match all service or namespace value 84 MatchAll = "*" 85 )