Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
44d41a0f
Commit
44d41a0f
authored
Feb 20, 2015
by
Andy Goldstein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move golang code to third_party
parent
86a0193f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
25 deletions
+80
-25
proxy.go
pkg/apiserver/proxy.go
+2
-1
roundtripper.go
pkg/util/httpstream/spdy/roundtripper.go
+2
-2
net.go
pkg/util/net.go
+0
-22
LICENSE
third_party/golang/LICENSE
+27
-0
PATENTS
third_party/golang/PATENTS
+22
-0
addr.go
third_party/golang/netutil/addr.go
+27
-0
No files found.
pkg/apiserver/proxy.go
View file @
44d41a0f
...
...
@@ -37,6 +37,7 @@ import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil"
"github.com/golang/glog"
"golang.org/x/net/html"
)
...
...
@@ -184,7 +185,7 @@ func (r *ProxyHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
connectionHeader
:=
strings
.
ToLower
(
req
.
Header
.
Get
(
httpstream
.
HeaderConnection
))
if
strings
.
Contains
(
connectionHeader
,
strings
.
ToLower
(
httpstream
.
HeaderUpgrade
))
&&
len
(
req
.
Header
.
Get
(
httpstream
.
HeaderUpgrade
))
>
0
{
//TODO support TLS? Doesn't look like proxyTransport does anything special ...
dialAddr
:=
util
.
CanonicalAddr
(
destURL
)
dialAddr
:=
net
util
.
CanonicalAddr
(
destURL
)
backendConn
,
err
:=
net
.
Dial
(
"tcp"
,
dialAddr
)
if
err
!=
nil
{
status
:=
errToAPIStatus
(
err
)
...
...
pkg/util/httpstream/spdy/roundtripper.go
View file @
44d41a0f
...
...
@@ -25,8 +25,8 @@ import (
"net/http"
"strings"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil"
)
// SpdyRoundTripper knows how to upgrade an HTTP request to one that supports
...
...
@@ -55,7 +55,7 @@ func NewRoundTripper(tlsConfig *tls.Config) httpstream.UpgradeRoundTripper {
// dial dials the host specified by req, using TLS if appropriate.
func
(
s
*
SpdyRoundTripper
)
dial
(
req
*
http
.
Request
)
(
net
.
Conn
,
error
)
{
dialAddr
:=
util
.
CanonicalAddr
(
req
.
URL
)
dialAddr
:=
net
util
.
CanonicalAddr
(
req
.
URL
)
if
req
.
URL
.
Scheme
==
"http"
{
return
net
.
Dial
(
"tcp"
,
dialAddr
)
...
...
pkg/util/net.go
View file @
44d41a0f
...
...
@@ -19,7 +19,6 @@ package util
import
(
"fmt"
"net"
"net/url"
"strings"
)
...
...
@@ -62,24 +61,3 @@ func (ipnet *IPNet) Set(value string) error {
func
(
*
IPNet
)
Type
()
string
{
return
"ipNet"
}
// FROM: http://golang.org/src/net/http/client.go
// Given a string of the form "host", "host:port", or "[ipv6::address]:port",
// return true if the string includes a port.
func
hasPort
(
s
string
)
bool
{
return
strings
.
LastIndex
(
s
,
":"
)
>
strings
.
LastIndex
(
s
,
"]"
)
}
// FROM: http://golang.org/src/net/http/transport.go
var
portMap
=
map
[
string
]
string
{
"http"
:
"80"
,
"https"
:
"443"
,
}
// FROM: http://golang.org/src/net/http/transport.go
// canonicalAddr returns url.Host but always with a ":port" suffix
func
CanonicalAddr
(
url
*
url
.
URL
)
string
{
addr
:=
url
.
Host
if
!
hasPort
(
addr
)
{
return
addr
+
":"
+
portMap
[
url
.
Scheme
]
}
return
addr
}
third_party/golang/LICENSE
0 → 100644
View file @
44d41a0f
Copyright (c) 2012 The Go Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
third_party/golang/PATENTS
0 → 100644
View file @
44d41a0f
Additional IP Rights Grant (Patents)
"This implementation" means the copyrightable works distributed by
Google as part of the Go project.
Google hereby grants to You a perpetual, worldwide, non-exclusive,
no-charge, royalty-free, irrevocable (except as stated in this section)
patent license to make, have made, use, offer to sell, sell, import,
transfer and otherwise run, modify and propagate the contents of this
implementation of Go, where such license applies only to those patent
claims, both currently owned or controlled by Google and acquired in
the future, licensable by Google that are necessarily infringed by this
implementation of Go. This grant does not include claims that would be
infringed only as a consequence of further modification of this
implementation. If you or your agent or exclusive licensee institute or
order or agree to the institution of patent litigation against any
entity (including a cross-claim or counterclaim in a lawsuit) alleging
that this implementation of Go or any code incorporated within this
implementation of Go constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any patent
rights granted to you under this License for this implementation of Go
shall terminate as of the date such litigation is filed.
third_party/golang/netutil/addr.go
0 → 100644
View file @
44d41a0f
package
netutil
import
(
"net/url"
"strings"
)
// FROM: http://golang.org/src/net/http/client.go
// Given a string of the form "host", "host:port", or "[ipv6::address]:port",
// return true if the string includes a port.
func
hasPort
(
s
string
)
bool
{
return
strings
.
LastIndex
(
s
,
":"
)
>
strings
.
LastIndex
(
s
,
"]"
)
}
// FROM: http://golang.org/src/net/http/transport.go
var
portMap
=
map
[
string
]
string
{
"http"
:
"80"
,
"https"
:
"443"
,
}
// FROM: http://golang.org/src/net/http/transport.go
// canonicalAddr returns url.Host but always with a ":port" suffix
func
CanonicalAddr
(
url
*
url
.
URL
)
string
{
addr
:=
url
.
Host
if
!
hasPort
(
addr
)
{
return
addr
+
":"
+
portMap
[
url
.
Scheme
]
}
return
addr
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment