Compare commits
3 Commits
1.0.0-4-g7
...
2023.9.5-s
Author | SHA1 | Date | |
---|---|---|---|
891cfa7540 | |||
d38f0be312 | |||
5be381d2b7 |
@ -5,6 +5,8 @@ set -eo pipefail
|
|||||||
OS_TARGETS=(linux)
|
OS_TARGETS=(linux)
|
||||||
ARCH_TARGETS=${ARCH_TARGETS:-amd64 mipsle}
|
ARCH_TARGETS=${ARCH_TARGETS:-amd64 mipsle}
|
||||||
|
|
||||||
|
export GOMIPS=softfloat
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||||
|
|
||||||
function build {
|
function build {
|
||||||
@ -29,7 +31,9 @@ function build {
|
|||||||
-o "$destdir/$name" \
|
-o "$destdir/$name" \
|
||||||
"$srcdir"
|
"$srcdir"
|
||||||
|
|
||||||
if [ ! -z "$(which upx)" ]; then
|
# Disable UPX compression for MIPS archs
|
||||||
|
# See https://github.com/upx/upx/issues/339
|
||||||
|
if [ ! -z "$(which upx)" ] && [[ ! "$arch" =~ "mips" ]]; then
|
||||||
upx --best "$destdir/$name"
|
upx --best "$destdir/$name"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -8,14 +8,13 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
peeringCrypto "forge.cadoles.com/Cadoles/go-http-peering/crypto"
|
peeringCrypto "forge.cadoles.com/Cadoles/go-http-peering/crypto"
|
||||||
|
|
||||||
peering "forge.cadoles.com/Cadoles/go-http-peering"
|
peering "forge.cadoles.com/Cadoles/go-http-peering"
|
||||||
jwt "github.com/dgrijalva/jwt-go"
|
jwt "github.com/dgrijalva/jwt-go"
|
||||||
|
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -38,7 +37,6 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc)
|
|||||||
|
|
||||||
middleware := func(next http.Handler) http.Handler {
|
middleware := func(next http.Handler) http.Handler {
|
||||||
fn := func(w http.ResponseWriter, r *http.Request) {
|
fn := func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
||||||
serverToken := r.Header.Get(ServerTokenHeader)
|
serverToken := r.Header.Get(ServerTokenHeader)
|
||||||
if serverToken == "" {
|
if serverToken == "" {
|
||||||
sendError(w, http.StatusUnauthorized)
|
sendError(w, http.StatusUnauthorized)
|
||||||
@ -77,6 +75,7 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
sendError(w, http.StatusUnauthorized)
|
sendError(w, http.StatusUnauthorized)
|
||||||
|
return
|
||||||
case ErrPeerRejected:
|
case ErrPeerRejected:
|
||||||
if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil {
|
if err := store.UpdateLastContact(serverClaims.PeerID, r.RemoteAddr, time.Now()); err != nil {
|
||||||
logger.Printf("[ERROR] %s", err)
|
logger.Printf("[ERROR] %s", err)
|
||||||
@ -115,7 +114,6 @@ func Authenticate(store peering.Store, key *rsa.PublicKey, funcs ...OptionFunc)
|
|||||||
r.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
r.Body = ioutil.NopCloser(bytes.NewBuffer(body))
|
||||||
|
|
||||||
next.ServeHTTP(w, r)
|
next.ServeHTTP(w, r)
|
||||||
|
|
||||||
}
|
}
|
||||||
return http.HandlerFunc(fn)
|
return http.HandlerFunc(fn)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user