Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
503c6b39
Commit
503c6b39
authored
Apr 29, 2017
by
Matt Holt
Committed by
GitHub
Apr 29, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1635 from aaronellington/lint-fixes
lint fixes
parents
705cb988
7ee4ea24
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
23 deletions
+25
-23
caddy.go
caddy.go
+3
-3
caddyhttp/browse/browse.go
caddyhttp/browse/browse.go
+3
-3
caddyhttp/httpserver/mitm.go
caddyhttp/httpserver/mitm.go
+4
-3
caddyhttp/httpserver/replacer.go
caddyhttp/httpserver/replacer.go
+2
-2
caddytls/config.go
caddytls/config.go
+12
-12
plugins.go
plugins.go
+1
-0
No files found.
caddy.go
View file @
503c6b39
...
...
@@ -768,7 +768,7 @@ func IsLoopback(addr string) bool {
// be an IP or an IP:port combination.
// Loopback addresses are considered false.
func
IsInternal
(
addr
string
)
bool
{
private
_n
etworks
:=
[]
string
{
private
N
etworks
:=
[]
string
{
"10.0.0.0/8"
,
"172.16.0.0/12"
,
"192.168.0.0/16"
,
...
...
@@ -786,8 +786,8 @@ func IsInternal(addr string) bool {
if
ip
==
nil
{
return
false
}
for
_
,
private
_network
:=
range
private_n
etworks
{
_
,
ipnet
,
_
:=
net
.
ParseCIDR
(
private
_n
etwork
)
for
_
,
private
Network
:=
range
privateN
etworks
{
_
,
ipnet
,
_
:=
net
.
ParseCIDR
(
private
N
etwork
)
if
ipnet
.
Contains
(
ip
)
{
return
true
}
...
...
caddyhttp/browse/browse.go
View file @
503c6b39
...
...
@@ -156,10 +156,10 @@ func (l byNameDirFirst) Less(i, j int) bool {
// if both are dir or file sort normally
if
l
.
Items
[
i
]
.
IsDir
==
l
.
Items
[
j
]
.
IsDir
{
return
strings
.
ToLower
(
l
.
Items
[
i
]
.
Name
)
<
strings
.
ToLower
(
l
.
Items
[
j
]
.
Name
)
}
else
{
// always sort dir ahead of file
return
l
.
Items
[
i
]
.
IsDir
}
// always sort dir ahead of file
return
l
.
Items
[
i
]
.
IsDir
}
// By Size
...
...
caddyhttp/httpserver/mitm.go
View file @
503c6b39
...
...
@@ -161,11 +161,11 @@ func parseRawClientHello(data []byte) (info rawHelloInfo) {
if
len
(
data
)
<
42
{
return
}
sessionI
d
Len
:=
int
(
data
[
38
])
if
sessionI
dLen
>
32
||
len
(
data
)
<
39
+
sessionId
Len
{
sessionI
D
Len
:=
int
(
data
[
38
])
if
sessionI
DLen
>
32
||
len
(
data
)
<
39
+
sessionID
Len
{
return
}
data
=
data
[
39
+
sessionI
d
Len
:
]
data
=
data
[
39
+
sessionI
D
Len
:
]
if
len
(
data
)
<
2
{
return
}
...
...
@@ -598,6 +598,7 @@ var greaseCiphers = map[uint16]struct{}{
0xFAFA
:
{},
}
// Define variables used for TLS communication
const
(
extensionOCSPStatusRequest
=
5
extensionSupportedCurves
=
10
// also called "SupportedGroups"
...
...
caddyhttp/httpserver/replacer.go
View file @
503c6b39
...
...
@@ -330,9 +330,9 @@ func (r *replacer) getSubstitution(key string) string {
if
val
,
ok
:=
r
.
request
.
Context
()
.
Value
(
caddy
.
CtxKey
(
"mitm"
))
.
(
bool
);
ok
{
if
val
{
return
"likely"
}
else
{
return
"unlikely"
}
return
"unlikely"
}
return
"unknown"
case
"{status}"
:
...
...
caddytls/config.go
View file @
503c6b39
...
...
@@ -232,8 +232,8 @@ func (c *Config) StorageFor(caURL string) (Storage, error) {
// buildStandardTLSConfig converts cfg (*caddytls.Config) to a *tls.Config
// and stores it in cfg so it can be used in servers. If TLS is disabled,
// no tls.Config is created.
func
(
c
fg
*
Config
)
buildStandardTLSConfig
()
error
{
if
!
c
fg
.
Enabled
{
func
(
c
*
Config
)
buildStandardTLSConfig
()
error
{
if
!
c
.
Enabled
{
return
nil
}
...
...
@@ -243,35 +243,35 @@ func (cfg *Config) buildStandardTLSConfig() error {
curvesAdded
:=
make
(
map
[
tls
.
CurveID
]
struct
{})
// add cipher suites
for
_
,
ciph
:=
range
c
fg
.
Ciphers
{
for
_
,
ciph
:=
range
c
.
Ciphers
{
if
_
,
ok
:=
ciphersAdded
[
ciph
];
!
ok
{
ciphersAdded
[
ciph
]
=
struct
{}{}
config
.
CipherSuites
=
append
(
config
.
CipherSuites
,
ciph
)
}
}
config
.
PreferServerCipherSuites
=
c
fg
.
PreferServerCipherSuites
config
.
PreferServerCipherSuites
=
c
.
PreferServerCipherSuites
// add curve preferences
for
_
,
curv
:=
range
c
fg
.
CurvePreferences
{
for
_
,
curv
:=
range
c
.
CurvePreferences
{
if
_
,
ok
:=
curvesAdded
[
curv
];
!
ok
{
curvesAdded
[
curv
]
=
struct
{}{}
config
.
CurvePreferences
=
append
(
config
.
CurvePreferences
,
curv
)
}
}
config
.
MinVersion
=
c
fg
.
ProtocolMinVersion
config
.
MaxVersion
=
c
fg
.
ProtocolMaxVersion
config
.
ClientAuth
=
c
fg
.
ClientAuth
config
.
NextProtos
=
c
fg
.
ALPN
config
.
GetCertificate
=
c
fg
.
GetCertificate
config
.
MinVersion
=
c
.
ProtocolMinVersion
config
.
MaxVersion
=
c
.
ProtocolMaxVersion
config
.
ClientAuth
=
c
.
ClientAuth
config
.
NextProtos
=
c
.
ALPN
config
.
GetCertificate
=
c
.
GetCertificate
// set up client authentication if enabled
if
config
.
ClientAuth
!=
tls
.
NoClientCert
{
pool
:=
x509
.
NewCertPool
()
clientCertsAdded
:=
make
(
map
[
string
]
struct
{})
for
_
,
caFile
:=
range
c
fg
.
ClientCerts
{
for
_
,
caFile
:=
range
c
.
ClientCerts
{
// don't add cert to pool more than once
if
_
,
ok
:=
clientCertsAdded
[
caFile
];
ok
{
continue
...
...
@@ -303,7 +303,7 @@ func (cfg *Config) buildStandardTLSConfig() error {
}
// store the resulting new tls.Config
c
fg
.
tlsConfig
=
config
c
.
tlsConfig
=
config
return
nil
}
...
...
plugins.go
View file @
503c6b39
...
...
@@ -217,6 +217,7 @@ func RegisterPlugin(name string, plugin Plugin) {
// EventName represents the name of an event used with event hooks.
type
EventName
string
// Define the event names for the startup and shutdown events
const
(
StartupEvent
EventName
=
"startup"
ShutdownEvent
EventName
=
"shutdown"
...
...
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