According to the Google Cloud documentation and the technical support team, creating a LoadBalancer kubernetes service will create a load balancer with direct server return, and therefore the incoming connection source IP address will be that of the originating client and not the load balancer. However that does not appear to be the case. This is a test kubernetes service + deployment that logs the incoming connection IP in order to validate whether Direct Server Return is working correctly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#region Copyright & License | |
/************************************************************************* | |
* | |
* The MIT License (MIT) | |
* | |
* Copyright (c) 2014 Roman Atachiants ([email protected]) | |
* Permission is hereby granted, free of charge, to any person obtaining a copy | |
* of this software and associated documentation files (the "Software"), to deal | |
* in the Software without restriction, including without limitation the rights |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void Awake() { | |
_deviceName = ""; | |
_microphone = Microphone.Start(_deviceName, true, 1, frequency); | |
if (_microphone == null) { | |
Debug.LogError("Unity returned a null microphone instance :S"); | |
return; | |
} | |
_numberOfChannels = _microphone.channels; | |
_sampleCount = _microphone.samples; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <yojimbo.h> | |
#include <miniz.h> | |
class PackedMessage : public yojimbo::BlockMessage | |
{ | |
public: | |
enum { MsgType = 0x00 }; | |
template <typename Stream> | |
bool Serialize(Stream& stream) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void TriggerEnded() | |
{ | |
// Throw the cube by setting the velocity on its rigid body using the rigid body on the empty game object. | |
Rigidbody rigidBody = _cube.GetComponent<Rigidbody>(); | |
rigidBody.velocity = _controllerRigidBody.GetPointVelocity(_controller.transform.TransformPoint(offset)); | |
rigidBody.angularVelocity = _controllerRigidBody.angularVelocity; | |
rigidBody.isKinematic = false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() { | |
/* ... */ | |
SteamVR_Controller.Device device = SteamVR_Controller.Input((int)_trackedObject.index); | |
// Set our empty game object's rigid body to match the device's velocity and angular velocity. | |
_controllerRigidBody.velocity = device.velocity; | |
_controllerRigidBody.angularVelocity = device.angularVelocity; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void PositionGeometry(Vector3 position, Quaternion rotation) | |
{ | |
// Position the empty game object. | |
_controller.transform.position = position; | |
_controller.transform.rotation = rotation; | |
// Position cube to be thrown | |
_cube.transform.position = position + rotation * offset; | |
_cube.transform.rotation = rotation; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Awake() | |
{ | |
/* ... */ | |
// Create an empty game object. Attach a rigid body to use later for calculating velocity. | |
_controller = new GameObject(); | |
_controllerRigidBody = _controller.AddComponent<Rigidbody>(); | |
_controllerRigidBody.isKinematic = true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Takes in a linear value from 0-1. Outputs the ease in/out version of it. | |
float value = linearValue*2.0; | |
if (value < 1.0) { | |
value = 0.5 * powf(value, 2.0); | |
} else { | |
value = 1.0 - 0.5 * powf(2.0-value, 2.0); | |
} | |
return value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
// Declare the rootUrl used for filtering internal links. | |
var rootUrl = document.location.protocol + '//' + (document.location.hostname || document.location.host) + (document.location.port ? ':' + document.location.port : '') + '/'; | |
// Helper functions | |
var getFragment = function(url, root) { // Grab the fragment and format it how Backbone expects | |
var fragment = url; | |
if (fragment.indexOf(':') !== -1) | |
fragment = fragment.replace(/.*:\/\/[^\/]+/, ''); | |
if (!fragment.indexOf(root)) fragment = fragment.substr(root.length); |