Commit 885169f4 authored by Your Name's avatar Your Name

Initial commit

parents
Pipeline #743 failed with stages
{
"swagger": "2.0",
"info": {
"title": "GPU+Model service",
"version": "1.0.0"
},
"paths": {
"/hw": {
"post": {
"summary": "get host hardware info and usage",
"responses": {
"200": {
"description": "success",
"schema": {
"$ref": "#/definitions/hw"
}
}
}
}
},
"/callback": {
"post": {}
}
},
"definitions": {
"hw": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int64"
},
"msg": {
"type": "string"
},
"data": {
"type": "object",
"properties": {
}
}
}
},
"gpu": {
"type": "object",
"properties": {
"seq": {
"type": "integer",
"format": "int64"
},
"model": {
"type": "string"
},
"mem_util": {
"type": "integer",
"format": "int64"
},
"total_mem": {
"type": "integer",
"format": "int64"
},
"power": {
"type": "integer",
"format": "int64"
},
"gpu_tmp": {
"type": "integer",
"format": "int64"
},
}
}
"cpu": {
"type": "object",
"properties": {
"seq": {
"type": "integer",
"format": "int64"
},
"model": {
"type": "string"
},
"mem_util": {
"type": "integer",
"format": "int64"
},
"total_mem": {
"type": "integer",
"format": "int64"
},
"power": {
"type": "integer",
"format": "int64"
},
"gpu_tmp": {
"type": "integer",
"format": "int64"
},
}
}
"mem": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int64"
},
"used": {
"type": "string"
},
"free": {
"type": "integer",
"format": "int64"
},
}
}
"disk": {
"type": "object",
"properties": {
"total": {
"type": "integer",
"format": "int64"
},
"mount": {
"type": "string"
},
"used": {
"type": "integer",
"format": "int64"
},
}
}
"network": {
"type": "object",
"properties": {
"seed": {
"type": "integer",
"format": "int64"
},
"send": {
"type": "integer",
"format": "int64"
},
"receive": {
"type": "integer",
"format": "int64"
},
}
}
"Error": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
}
}
}
}
}
openapi: 3.0.0
servers:
- url: http://124.193.167.71:5001/
description: Default server
info:
description: |
This is a sample sniper wallet server.
You can find out more http://124.193.167.71:8001/docs/polygon/Uniswap
## Introduction
This API is documented in **OpenAPI format** and is based on
version: 0.0.1
title: Swagger Uniswap Wallet YAML
termsOfService: "http://swagger.io/terms/"
contact:
name: API Support
email: apiteam@swagger.io
url: https://github.com/Redocly/redoc
x-logo:
url: "https://redocly.github.io/redoc/petstore-logo.png"
altText: Petstore logo
license:
name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
externalDocs:
description: Find out how to create Github repo for your OpenAPI spec.
url: "https://github.com/Rebilly/generator-openapi-repo"
tags:
- name: MonitorHardware
description: Everything about host hardware
# - name: User
# description: Everything about user
# - name: store
# description: Access to Petstore orders
# x-displayName: Petstore Orders
# - name: user
# description: Operations about user
# x-displayName: Users
# - name: pet_model
# x-displayName: The Pet Model
# description: |
# <SchemaDefinition schemaRef="#/components/schemas/Pet" />
# - name: store_model
# x-displayName: The Order Model
# description: |
# <SchemaDefinition schemaRef="#/components/schemas/Order" exampleRef="#/components/examples/Order" showReadOnly={true} showWriteOnly={true} />
x-tagGroups:
- name: General
tags:
- pet
- store
- name: User Management
tags:
- user
- name: Models
tags:
- pet_model
- store_model
paths:
/hw:
get:
summary: get host hardware info and usage
tags:
- MonitorHardware
responses:
"200":
description: successful operation
headers:
X-ProxyBodyHash-SignatureCode:
type: integer
enum: [200, 500]
description: sign status code.
X-ProxyBodyHash-SignatureErr:
type: string
description: sign error msg.
X-ProxyBodyHash:
type: string
description: response body hash value.
X-ProxyBodyHash-Signature:
type: string
description: signature for hash.
content:
application/json:
schema:
type: object
properties:
data:
$ref: "#/components/schemas/hw"
code:
type: integer
format: int64
enum: [200, 500]
msg:
type: string
components:
securitySchemes:
api_key:
description: |
For this sample, you can use the api key `special-key` to test the authorization filters.
in: header
name: api_key
type: apiKey
petstore_auth:
description: |
Get access to data while protecting your account credentials.
OAuth2 is also a safer and more secure way to give you access.
flows:
implicit:
authorizationUrl: http://petstore.swagger.io/api/oauth/dialog
scopes:
read:pets: read your pets
write:pets: modify pets in your account
type: oauth2
schemas:
hw:
type: object
properties:
gpus:
type: array
items:
$ref: "#/components/schemas/gpu"
cpus:
type: object
properties:
total_util:
type: integer
format: int64
list:
type: array
items:
$ref: "#/components/schemas/cpu"
mem:
type: object
properties:
mem_total:
type: integer
format: int64
mem_free:
type: integer
format: int64
mem_util:
type: integer
format: int64
disk:
type: array
items:
$ref: "#/components/schemas/filesystem"
networks:
type: array
items:
$ref: "#/components/schemas/network"
network:
type: object
properties:
device:
type: string
speed:
type: integer
format: int64
send_rate:
type: integer
format: int64
recv_rate:
type: integer
format: int64
filesystem:
type: object
properties:
device:
type: string
mount_points:
type: array
items:
type: string
free_bytes:
type: integer
format: int64
size_bytes:
type: integer
format: int64
gpu:
type: object
properties:
seq:
type: integer
format: int64
model:
type: string
mem_util:
type: integer
format: int64
gpu_util:
type: integer
format: int64
mem_total:
type: integer
format: int64
mem_free:
type: integer
format: int64
power:
type: integer
format: int64
gpu_temp:
type: integer
format: int64
cpu:
type: object
properties:
seq:
type: integer
format: int64
model:
description: addr
type: string
thread:
type: integer
format: int64
core:
type: integer
format: int64
module proxyWithSign
go 1.22.1
require github.com/gofiber/fiber/v2 v2.52.4
require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/andybalholm/brotli v1.0.5 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-ethereum v1.14.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.4 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/gofiber/swagger v1.0.0 // indirect
github.com/google/uuid v1.5.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/holiman/uint256 v1.2.4 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rs/cors v1.11.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/storyicon/sigverify v1.1.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/swaggo/files/v2 v2.0.0 // indirect
github.com/swaggo/swag v1.16.3 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/crypto v0.22.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/net v0.24.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.20.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow=
github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM=
github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tNFfI=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/bits-and-blooms/bitset v1.10.0 h1:ePXTeiPEazB5+opbv5fr8umg2R/1NlzgDsyepwsSr88=
github.com/bits-and-blooms/bitset v1.10.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8=
github.com/btcsuite/btcd/btcec/v2 v2.2.0 h1:fzn1qaOt32TuLjFlkzYSsBC35Q3KUjT1SwPxiMSCF5k=
github.com/btcsuite/btcd/btcec/v2 v2.2.0/go.mod h1:U7MHm051Al6XmscBQ0BoNydpOTsFAn707034b5nY8zU=
github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ=
github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI=
github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M=
github.com/consensys/gnark-crypto v0.12.1/go.mod h1:v2Gy7L/4ZRosZ7Ivs+9SfUDr0f5UlG+EM5t7MPHiLuY=
github.com/crate-crypto/go-kzg-4844 v1.0.0 h1:TsSgHwrkTKecKJ4kadtHi4b3xHW5dCFUDFnUp1TsawI=
github.com/crate-crypto/go-kzg-4844 v1.0.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set v1.8.0 h1:sk9/l/KqpunDwP7pSjUg0keiOOLEnOBHzykLrsPppp4=
github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI=
github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 h1:YLtO71vCjJRCBcrPMtQ9nqBsqpA1m5sE92cU+pd5Mcc=
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs=
github.com/ethereum/c-kzg-4844 v1.0.0 h1:0X1LBXxaEtYD9xsyj9B9ctQEZIpnvVDeoBx8aHEwTNA=
github.com/ethereum/c-kzg-4844 v1.0.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
github.com/ethereum/go-ethereum v1.14.0 h1:xRWC5NlB6g1x7vNy4HDBLuqVNbtLrc7v8S6+Uxim1LU=
github.com/ethereum/go-ethereum v1.14.0/go.mod h1:1STrq471D0BQbCX9He0hUj4bHxX2k6mt5nOQJhDNOJ8=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs=
github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns=
github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M=
github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/gofiber/fiber/v2 v2.52.4 h1:P+T+4iK7VaqUsq2PALYEfBBo6bJZ4q3FP8cZ84EggTM=
github.com/gofiber/fiber/v2 v2.52.4/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ=
github.com/gofiber/swagger v1.0.0 h1:BzUzDS9ZT6fDUa692kxmfOjc1DZiloLiPK/W5z1H1tc=
github.com/gofiber/swagger v1.0.0/go.mod h1:QrYNF1Yrc7ggGK6ATsJ6yfH/8Zi5bu9lA7wB8TmCecg=
github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU=
github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rs/cors v1.11.0 h1:0B9GE/r9Bc2UxRMMtymBkHTenPkHDv0CW4Y98GBY+po=
github.com/rs/cors v1.11.0/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/storyicon/sigverify v1.1.0 h1:Fz153Jvloz1P0G3TrG7dHGyAlB3mpjmFeu5IszfJWQ0=
github.com/storyicon/sigverify v1.1.0/go.mod h1:q0qxvhdUsMIBAry3h7/IMW7BebRkiT8496TrQP1XW5s=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/supranational/blst v0.3.11 h1:LyU6FolezeWAhvQk0k6O/d49jqgO52MSDDfYgbeoEm4=
github.com/supranational/blst v0.3.11/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw=
github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw=
github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM=
github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg=
github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk=
github.com/tklauser/go-sysconf v0.3.12 h1:0QaGUFOdQaIVdPgfITYzaTegZvdCjmYO52cSFAEVmqU=
github.com/tklauser/go-sysconf v0.3.12/go.mod h1:Ho14jnntGE1fpdOqQEEaiKRpvIavV0hSfmBq8nJbHYI=
github.com/tklauser/numcpus v0.6.1 h1:ng9scYS7az0Bk4OZLvrNXNSAO2Pxr1XXRAPyjhIx+Fk=
github.com/tklauser/numcpus v0.6.1/go.mod h1:1XfjsgE2zo8GVw7POkMbHENHzVg3GzmoZ9fESEdAacY=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
github.com/valyala/fasthttp v1.51.0/go.mod h1:oI2XroL+lI7vdXyYoQk03bXBThfFl2cVdIA3Xl7cH8g=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA=
golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s=
golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY=
golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
rsc.io/tmplfunc v0.0.3 h1:53XFQh69AfOa8Tw0Jm7t+GV7KZhOi6jzsCzTtKbMvzU=
rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA=
package main
import (
"fmt"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rlp"
"github.com/gofiber/fiber/v2"
"github.com/gofiber/fiber/v2/middleware/cors"
"github.com/gofiber/fiber/v2/middleware/proxy"
"github.com/gofiber/swagger"
"golang.org/x/crypto/sha3"
"github.com/ethereum/go-ethereum/accounts"
)
func main() {
// app := fiber.New(fiber.Config{
// // Prefork: true,
// // CaseSensitive: true,
// // StrictRouting: true,
// ServerHeader: "Fiber",
// AppName: "proxy with signature",
// })
// app := fiber.New()
// app.Use(cors.New())
app := fiber.New()
app.Use(cors.New())
app.Static("/swagger/docs", "./docs")
app.Get("/swagger/*", swagger.New(swagger.Config{ // custom
URL: "http://124.193.167.71:5001/swagger/docs/swagger.yaml", //http://124.193.167.71:8000/
DeepLinking: false,
// Expand ("list") or Collapse ("none") tag groups by default
DocExpansion: "none",
// Prefill OAuth ClientId on Authorize popup
// OAuth: &swagger.OAuthConfig{
// AppName: "OAuth Provider",
// ClientId: "21bb4edc-05a7-4afc-86f1-2e151e4ba6e2",
// },
// Ability to change OAuth2 redirect uri location
//OAuth2RedirectUrl: "http://localhost:8080/swagger/oauth2-redirect.html",
}))
app.All("/*", func(c *fiber.Ctx) error {
path := c.Path()
fmt.Println("path", path)
url := "http://124.193.167.71:5000" + path
if err := proxy.Do(c, url); err != nil {
return err
}
// Remove Server header from response
//c.Response().Header.Del(fiber.HeaderServer)
//h := rlpHash(c.Response().Body())
//fmt.Printf("%x\n", accounts.TextHash([]byte("hello")))
//h := rlpHash("hello")
//h := accounts.TextHash([]byte("hello"))
h := accounts.TextHash([]byte(string(c.Response().Body())))
fmt.Printf("%x\n", h)
//prv *ecdsa.PrivateKey
// privateKey, _, err := getPrivateKeyByIdx(0)
// if err != nil {
// t.Fatal(err)
// }
fmt.Println("c.Response().Body():", string(c.Response().Body()))
local, _ := crypto.HexToECDSA("4df7e0d1c1329d03c72ed0cec631adc048ae85178d3528e7f55368da0901ed5b")
sig, err := crypto.Sign(h[:], local)
if err != nil {
fmt.Println("error", err.Error(), "hash", fmt.Sprintf("%x", h), "body", string(c.Response().Body()))
//return nil, err
c.Response().Header.Add("X-ProxyBodyHash-SignatureCode", "500")
c.Response().Header.Add("X-ProxyBodyHash-SignatureErr", err.Error())
} else {
c.Response().Header.Add("X-ProxyBodyHash-SignatureCode", "200")
}
//return tx.WithSignature(s, sig)
c.Response().Header.Add("X-ProxyBodyHash", fmt.Sprintf("%x", h))
c.Response().Header.Add("X-ProxyBodyHash-Signature", fmt.Sprintf("%x", sig))
return nil
})
if err := app.Listen(":5001"); err != nil {
fmt.Println(" app.Listen", err.Error())
}
}
// Hash returns the hash to be signed by the sender.
// It does not uniquely identify the transaction.
// func (s EIP155Signer) Hash(tx *Transaction) common.Hash {
// return rlpHash([]interface{}{
// tx.Nonce(),
// tx.GasPrice(),
// tx.Gas(),
// tx.To(),
// tx.Value(),
// tx.Data(),
// s.chainId, uint(0), uint(0),
// })
// }
// SignTx signs the transaction using the given signer and private key.
// func SignTx(tx *Transaction, s Signer, prv *ecdsa.PrivateKey) (*Transaction, error) {
// h := s.Hash(tx)
// sig, err := crypto.Sign(h[:], prv)
// if err != nil {
// return nil, err
// }
// return tx.WithSignature(s, sig)
// }
// Hash returns the hash to be signed by the sender.
// It does not uniquely identify the transaction.
// func (s EIP155Signer) Hash(tx *Transaction) common.Hash {
// return rlpHash([]interface{}{
// tx.Nonce(),
// tx.GasPrice(),
// tx.Gas(),
// tx.To(),
// tx.Value(),
// tx.Data(),
// s.chainId, uint(0), uint(0),
// })
// }
// rlpHash encodes x and hashes the encoded bytes.
func rlpHash(x interface{}) (h common.Hash) {
sha := hasherPool.Get().(crypto.KeccakState)
defer hasherPool.Put(sha)
sha.Reset()
rlp.Encode(sha, x)
sha.Read(h[:])
return h
}
// import (
// "bytes"
// "sync"
// "github.com/ethereum/go-ethereum/common"
// "github.com/ethereum/go-ethereum/crypto"
// "github.com/ethereum/go-ethereum/rlp"
// "golang.org/x/crypto/sha3"
// )
// hasherPool holds LegacyKeccak256 hashers for rlpHash.
var hasherPool = sync.Pool{
New: func() interface{} { return sha3.NewLegacyKeccak256() },
}
package main
import (
"fmt"
"testing"
ethcommon "github.com/ethereum/go-ethereum/common"
"github.com/storyicon/sigverify"
)
func TestVerify(t *testing.T) {
valid, err := sigverify.VerifyEllipticCurveHexSignatureEx(
ethcommon.HexToAddress("0xb052C02346F80cF6ae4DF52c10FABD3e0aD24d81"),
[]byte("hello"),
"0x0498c6564863c78e663848b963fde1ea1d860d5d882d2abdb707d1e9179ff80630a4a71705da534a562c08cb64a546c6132de26eb77a44f086832cbc1dbe01f71b",
)
fmt.Println(valid, err) // true <nil>
}
func TestVerifyHttp(t *testing.T) {
//fmt.Printf("%x\n", accounts.TextHash([]byte("hello")))
valid, err := sigverify.VerifyEllipticCurveHexSignatureEx(
ethcommon.HexToAddress("0xEC7D4Cc269c5B90ba88E481a3904608a799A1f9F"),
[]byte(`{"data":{"gpus":[{"seq":0,"model":"NVIDIA GeForce RTX 3080","mem_util":0,"gpu_util":0,"mem_total":10554966016,"mem_free":9848225792,"power":3,"gpu_temp":24},{"seq":1,"model":"NVIDIA GeForce RTX 3080","mem_util":0,"gpu_util":0,"mem_total":10554966016,"mem_free":10539237376,"power":6,"gpu_temp":23},{"seq":2,"model":"NVIDIA GeForce RTX 3080","mem_util":0,"gpu_util":0,"mem_total":10554966016,"mem_free":10370416640,"power":7,"gpu_temp":22}],"cpus":{"total_util":0,"list":[{"seq":0,"model":"Intel(R) Xeon(R) CPU E5-2698 v3 @ 2.30GHz","thread":64,"core":32}]},"disk":[{"device":"/dev/sda2","mount_points":["/"],"free_bytes":415869456384,"size_bytes":588445270016},{"device":"/dev/sdc","mount_points":["/","/mnt/wslg/distro","/snap","/var/lib/docker"],"free_bytes":788169621504,"size_bytes":1081101176832},{"device":"C:\\134","mount_points":["/mnt/c"],"free_bytes":81437052928,"size_bytes":126873276416},{"device":"D:\\134","mount_points":["/mnt/d"],"free_bytes":946958905344,"size_bytes":2000381014016},{"device":"none","mount_points":["/usr/lib/wsl/drivers","/mnt/wsl","/mnt/wslg","/run","/run/lock","/run/shm","/run/user","/tmp/.X11-unix","/usr/lib/modules"],"free_bytes":81437052928,"size_bytes":126873276416},{"device":"rootfs","mount_points":["/init"],"free_bytes":67501084672,"size_bytes":67503013888},{"device":"snapfuse","mount_points":["/snap/bare/5","/snap/core22/1122","/snap/gtk-common-themes/1535","/snap/snapd/21184","/snap/snapd/21465","/snap/ubuntu-desktop-installer/1276","/snap/ubuntu-desktop-installer/1286","/snap/core22/1380"],"free_bytes":0,"size_bytes":131072},{"device":"tmpfs","mount_points":["/run","/run/lock","/run/snapd/ns","/run/user/1000"],"free_bytes":27038982144,"size_bytes":27042263040}],"networks":[{"device":"br-912d945026d7","speed":-125000,"send_rate":0,"recv_rate":0,"mac":"02:42:99:2c:2d:26"},{"device":"br-b127f187b58e","speed":-125000,"send_rate":0,"recv_rate":0,"mac":"02:42:5a:57:24:09"},{"device":"docker0","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"02:42:cc:45:c6:2f"},{"device":"eno1","speed":125000000,"send_rate":0,"recv_rate":0,"mac":"0c:c4:7a:0f:8b:6c"},{"device":"eno2","speed":125000000,"send_rate":0,"recv_rate":0,"mac":"0c:c4:7a:0f:8b:6d"},{"device":"eth0","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"00:15:5d:25:53:b3"},{"device":"veth00bbb33","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"26:46:85:ac:26:63"},{"device":"veth2cce297","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"5e:e7:89:db:3e:99"},{"device":"veth3dfcc27","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"6a:29:38:8f:e5:b8"},{"device":"veth3fc0bbe","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"4a:0b:53:0c:cb:2f"},{"device":"veth60e1761","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"3e:cd:9b:09:47:5f"},{"device":"veth6ef4326","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"36:2f:4c:f6:20:c3"},{"device":"veth89e35e6","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"f2:c2:fd:e0:4b:92"},{"device":"vethb1e1ee6","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"92:db:39:a3:87:41"},{"device":"vethb366d68","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"a2:fb:44:3b:0b:b3"},{"device":"vethb717a07","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"22:bc:00:58:39:f3"},{"device":"vethdd61b14","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"4a:fa:fc:f7:b1:77"},{"device":"vethf4faaeb","speed":1250000000,"send_rate":0,"recv_rate":0,"mac":"da:a5:9f:2c:02:02"}],"mem":{"mem_total":135012700160,"mem_free":128288522240,"mem_util":4}},"code":200,"msg":""}`),
//[]byte("hello"),
"0x3b17242860aa808687e5b26938af47d143340c1bbd19861e1fbca6989321046a3fdb0d5127c179c2463a89c1f2fc8e1d08635ba46c23d60c218959c2a0013d8f01",
)
fmt.Println(valid, err) // true <nil>
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment