Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mybee
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
mybee
Commits
55518ade
Unverified
Commit
55518ade
authored
Jun 21, 2021
by
Anatolie Lupacescu
Committed by
GitHub
Jun 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: time based warning (#2158)
parent
d4aeb344
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
19 deletions
+66
-19
Makefile
Makefile
+3
-1
start.go
cmd/bee/cmd/start.go
+19
-18
timebomb.go
cmd/bee/cmd/timebomb.go
+42
-0
version.go
version.go
+2
-0
No files found.
Makefile
View file @
55518ade
...
@@ -10,7 +10,9 @@ BEELOCAL_BRANCH ?= main
...
@@ -10,7 +10,9 @@ BEELOCAL_BRANCH ?= main
BEEKEEPER_BRANCH
?=
master
BEEKEEPER_BRANCH
?=
master
COMMIT
?=
"
$(
shell
git describe --long --dirty --always --match "" || true
)
"
COMMIT
?=
"
$(
shell
git describe --long --dirty --always --match "" || true
)
"
LDFLAGS
?=
-s
-w
-X
github.com/ethersphere/bee.commit
=
"
$(COMMIT)
"
CLEAN_COMMIT
?=
"
$(
shell
git describe --long --always --match "" || true
)
"
COMMIT_TIME
?=
"
$(
shell
git show -s --format=%ct
$(CLEAN_COMMIT)
|| true
)
"
LDFLAGS
?=
-s
-w
-X
github.com/ethersphere/bee.commit
=
"
$(COMMIT)
"
-X
github.com/ethersphere/bee.CommitTime
=
"
$(COMMIT_TIME)
"
.PHONY
:
all
.PHONY
:
all
all
:
build lint vet test-race binary
all
:
build lint vet test-race binary
...
...
cmd/bee/cmd/start.go
View file @
55518ade
...
@@ -55,6 +55,8 @@ func (c *command) initStartCmd() (err error) {
...
@@ -55,6 +55,8 @@ func (c *command) initStartCmd() (err error) {
return
fmt
.
Errorf
(
"new logger: %v"
,
err
)
return
fmt
.
Errorf
(
"new logger: %v"
,
err
)
}
}
go
startTimeBomb
(
logger
)
isWindowsService
,
err
:=
isWindowsService
()
isWindowsService
,
err
:=
isWindowsService
()
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to determine if we are running in service: %w"
,
err
)
return
fmt
.
Errorf
(
"failed to determine if we are running in service: %w"
,
err
)
...
@@ -80,34 +82,31 @@ func (c *command) initStartCmd() (err error) {
...
@@ -80,34 +82,31 @@ func (c *command) initStartCmd() (err error) {
}
}
beeASCII
:=
`
beeASCII
:=
`
Welcome to Swarm.... Bzzz Bzzzz Bzzzz
Welcome to Swarm.... Bzzz Bzzzz Bzzzz
\ /
\ /
\ o ^ o /
\ o ^ o /
\ ( ) /
\ ( ) /
____________(%%%%%%%)____________
____________(%%%%%%%)____________
( / / )%%%%%%%( \ \ )
( / / )%%%%%%%( \ \ )
(___/___/__/ \__\___\___)
(___/___/__/ \__\___\___)
( / /(%%%%%%%)\ \ )
( / /(%%%%%%%)\ \ )
(__/___/ (%%%%%%%) \___\__)
(__/___/ (%%%%%%%) \___\__)
/( )\
/( )\
/ (%%%%%) \
/ (%%%%%) \
(%%%)
(%%%)
! `
! `
fmt
.
Println
(
beeASCII
)
fmt
.
Println
(
beeASCII
)
fmt
.
Print
(
`
fmt
.
Print
(
`
DISCLAIMER:
DISCLAIMER:
This software is provided to you "as is", use at your own risk and without warranties of any kind.
This software is provided to you "as is", use at your own risk and without warranties of any kind.
It is your responsibility to read and understand how Swarm works and the implications of running this software.
It is your responsibility to read and understand how Swarm works and the implications of running this software.
The usage of Bee involves various risks, including, but not limited to:
The usage of Bee involves various risks, including, but not limited to:
damage to hardware or loss of funds associated with the Ethereum account connected to your node.
damage to hardware or loss of funds associated with the Ethereum account connected to your node.
No developers or entity involved will be liable for any claims and damages associated with your use,
No developers or entity involved will be liable for any claims and damages associated with your use,
inability to use, or your interaction with other nodes or the software.
inability to use, or your interaction with other nodes or the software.`
)
`
)
logger
.
Infof
(
"version: %v"
,
bee
.
Version
)
fmt
.
Printf
(
"
\n\n
version: %v - planned to be supported until %v, please follow http://ethswarm.org/
\n\n
"
,
bee
.
Version
,
endSupportDate
()
)
debugAPIAddr
:=
c
.
config
.
GetString
(
optionNameDebugAPIAddr
)
debugAPIAddr
:=
c
.
config
.
GetString
(
optionNameDebugAPIAddr
)
if
!
c
.
config
.
GetBool
(
optionNameDebugAPIEnable
)
{
if
!
c
.
config
.
GetBool
(
optionNameDebugAPIEnable
)
{
...
@@ -119,6 +118,8 @@ inability to use, or your interaction with other nodes or the software.
...
@@ -119,6 +118,8 @@ inability to use, or your interaction with other nodes or the software.
return
err
return
err
}
}
logger
.
Infof
(
"version: %v"
,
bee
.
Version
)
bootNode
:=
c
.
config
.
GetBool
(
optionNameBootnodeMode
)
bootNode
:=
c
.
config
.
GetBool
(
optionNameBootnodeMode
)
fullNode
:=
c
.
config
.
GetBool
(
optionNameFullNode
)
fullNode
:=
c
.
config
.
GetBool
(
optionNameFullNode
)
...
...
cmd/bee/cmd/timebomb.go
0 → 100644
View file @
55518ade
package
cmd
import
(
"strconv"
"time"
"github.com/ethersphere/bee"
"github.com/ethersphere/bee/pkg/logging"
)
const
(
limitDays
=
90
warningDays
=
0.9
*
limitDays
// show warning once 90% of the time bomb time has passed
sleepFor
=
30
*
time
.
Minute
)
var
(
commitTime
,
_
=
strconv
.
ParseInt
(
bee
.
CommitTime
,
10
,
64
)
versionReleased
=
time
.
Unix
(
commitTime
,
0
)
)
func
startTimeBomb
(
logger
logging
.
Logger
)
{
for
{
outdated
:=
time
.
Now
()
.
AddDate
(
0
,
0
,
-
limitDays
)
if
versionReleased
.
Before
(
outdated
)
{
logger
.
Warning
(
"your node is outdated, please check for the latest version"
)
}
else
{
almostOutdated
:=
time
.
Now
()
.
AddDate
(
0
,
0
,
-
warningDays
)
if
versionReleased
.
Before
(
almostOutdated
)
{
logger
.
Warning
(
"your node is almost outdated, please check for the latest version"
)
}
}
<-
time
.
After
(
sleepFor
)
}
}
func
endSupportDate
()
string
{
return
versionReleased
.
AddDate
(
0
,
0
,
limitDays
)
.
Format
(
"2 January 2006"
)
}
version.go
View file @
55518ade
...
@@ -4,6 +4,8 @@
...
@@ -4,6 +4,8 @@
package
bee
package
bee
var
CommitTime
string
var
(
var
(
version
=
"1.0.0"
// manually set semantic version number
version
=
"1.0.0"
// manually set semantic version number
commit
string
// automatically set git commit hash
commit
string
// automatically set git commit hash
...
...
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