128d20c9bf
* Upgrade geth from 1.8.15 to 1.8.18 * Update vat_tune to use shared repository methods * Query blockchain by block hash instead of block number range * Remove hash validation from repositories * Fix vow flog integration test * Update README Travis build sticker * Update constants formatting per go fmt * Update EthPublicKeyParser.ParsePublicKey to use discv5.PubkeyID method * Address PR comments
35 lines
659 B
Go
35 lines
659 B
Go
package http
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/ethereum/go-ethereum/swarm/api"
|
|
"github.com/ethereum/go-ethereum/swarm/sctx"
|
|
)
|
|
|
|
type uriKey struct{}
|
|
|
|
func GetRUID(ctx context.Context) string {
|
|
v, ok := ctx.Value(sctx.HTTPRequestIDKey{}).(string)
|
|
if ok {
|
|
return v
|
|
}
|
|
return "xxxxxxxx"
|
|
}
|
|
|
|
func SetRUID(ctx context.Context, ruid string) context.Context {
|
|
return context.WithValue(ctx, sctx.HTTPRequestIDKey{}, ruid)
|
|
}
|
|
|
|
func GetURI(ctx context.Context) *api.URI {
|
|
v, ok := ctx.Value(uriKey{}).(*api.URI)
|
|
if ok {
|
|
return v
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func SetURI(ctx context.Context, uri *api.URI) context.Context {
|
|
return context.WithValue(ctx, uriKey{}, uri)
|
|
}
|