Skip to content

Commit

Permalink
Merge from master into firebase (#65)
Browse files Browse the repository at this point in the history
* Simple TCP server to show how to retrieve original dest IP:port after an iptables redirect (#38)

* Simple TCP server to show how to retrieve original dest IP:port after an iptables redirect

* Fixed style.

* Rebase Envoy (#41)

* Update prototype to use iptables (#42)

* Rebase to fixed Envoy (#43)

* Handle HEAD request. (#34)

* Handle HEAD request.

* Try with GET if HEAD fails.

* Address comments.

* Format file.

* Expose bazel target (#48)

* Try again (#49)

* Integrate with mixer client. (#55)

* Integrate with mixer client.

* Restore  repositories.bzl back.

* Add originIp and originHost attributes. (#56)

* Add uuid-dev dependency in README.md (#45)

* Extract originIp and OriginHost. (#57)

* Extract originIp and OriginHost.

* Make header x-forwarded-host const.

* Update buckets for UI. (#58)

* Update buckets for UI.

* Only update time_distribution.

* Add targetService attribute. (#59)

* Use envoy new access_log handler for sending Report. (#60)

* use access_log handler.

* Not to use Loggable base class.

* Update to the latest envoy with #396. (#61)

* Fix tclap dependency fetching error (#62)
  • Loading branch information
sarvaniv authored Feb 3, 2017
1 parent df8c69c commit b27d4b9
Show file tree
Hide file tree
Showing 19 changed files with 650 additions and 308 deletions.
22 changes: 20 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,34 @@ googletest_repositories()
load(
"//contrib/endpoints:repositories.bzl",
"grpc_repositories",
"mixerapi_repositories",
"mixer_client_repositories",
"servicecontrol_client_repositories",
)

grpc_repositories()

mixerapi_repositories()
mixer_client_repositories()

servicecontrol_client_repositories()

# Workaround for Bazel > 0.4.0 since it needs newer protobuf.bzl from:
# https://github.com/google/protobuf/pull/2246
# Do not use this git_repository for anything else than protobuf.bzl
new_git_repository(
name = "protobuf_bzl",
# Injecting an empty BUILD file to prevent using any build target
build_file_content = "",
commit = "05090726144b6e632c50f47720ff51049bfcbef6",
remote = "https://github.com/google/protobuf.git",
)

load(
"@mixerclient_git//:repositories.bzl",
"mixerapi_repositories",
)

mixerapi_repositories(protobuf_repo="@protobuf_bzl//")

load(
"//src/envoy:repositories.bzl",
"envoy_repositories",
Expand Down
2 changes: 2 additions & 0 deletions contrib/endpoints/include/api_manager/request.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class Request {
// Gets Client IP
// This will be used by service control Check() call.
virtual std::string GetClientIP() = 0;
// Gets Client Host.
virtual std::string GetClientHost() { return ""; }

// Get GRPC stats.
virtual int64_t GetGrpcRequestBytes() = 0;
Expand Down
52 changes: 8 additions & 44 deletions contrib/endpoints/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -334,51 +334,15 @@ def servicecontrol_client_repositories(bind=True):
actual = "@servicecontrol_client_git//:service_control_client_lib",
)

def mixerapi_repositories(protobuf_repo="@protobuf_git//", bind=True):
BUILD = """
# Copyright 2016 Google Inc. All Rights Reserved.
#
# 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.
#
################################################################################
#
licenses(["notice"])
load("{}:protobuf.bzl", "cc_proto_library")
cc_proto_library(
name = "mixer_api_cc_proto",
srcs = glob(
["mixer/api/v1/*.proto"],
),
default_runtime = "//external:protobuf",
protoc = "//external:protoc",
visibility = ["//visibility:public"],
deps = [
"//external:cc_wkt_protos",
"//external:servicecontrol",
],
)
""".format(protobuf_repo)

native.new_git_repository(
name = "mixerapi_git",
commit = "fc5a396185edc72d06d1937f30a8148a37d4fc1b",
remote = "https://github.com/istio/api.git",
build_file_content = BUILD,
def mixer_client_repositories(bind=True):
native.git_repository(
name = "mixerclient_git",
commit = "80e450a5126960e8e6337c3631cf2ef984038eab",
remote = "https://github.com/istio/mixerclient.git",
)

if bind:
native.bind(
name = "mixer_api_cc_proto",
actual = "@mixerapi_git//:mixer_api_cc_proto",
name = "mixer_client_lib",
actual = "@mixerclient_git//:mixer_client_lib",
)
3 changes: 2 additions & 1 deletion contrib/endpoints/src/api_manager/context/request_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ void RequestContext::FillOperationInfo(service_control::OperationInfo *info) {
info->producer_project_id = service_context()->project_id();
info->referer = http_referer_;
info->request_start_time = start_time_;
info->client_ip = request_->GetClientIP();
info->client_host = request_->GetClientHost();
}

void RequestContext::FillLocation(service_control::ReportRequestInfo *info) {
Expand Down Expand Up @@ -221,7 +223,6 @@ void RequestContext::FillLogMessage(service_control::ReportRequestInfo *info) {
void RequestContext::FillCheckRequestInfo(
service_control::CheckRequestInfo *info) {
FillOperationInfo(info);
info->client_ip = request_->GetClientIP();
info->allow_unregistered_calls = method()->allow_unregistered_calls();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ const int kIntermediateReportInterval = 10;

const char kHTTPHeadMethod[] = "HEAD";
const char kHTTPGetMethod[] = "GET";

const char kFirebaseAudience[] =
"https://staging-firebaserules.sandbox.googleapis.com/"
"google.firebase.rules.v1.FirebaseRulesService";
Expand Down
6 changes: 3 additions & 3 deletions contrib/endpoints/src/api_manager/mixer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ cc_library(
],
}),
deps = [
"//external:grpc++",
"//external:mixer_api_cc_proto",
"//external:protobuf",
"//contrib/endpoints/src/api_manager:impl_headers",
"//contrib/endpoints/src/api_manager/service_control",
"//contrib/endpoints/src/api_manager/utils",
"//external:grpc++",
"//external:mixer_client_lib",
"//external:protobuf",
],
)
Loading

0 comments on commit b27d4b9

Please sign in to comment.