Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
bitmask-vpn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julian Merlin
bitmask-vpn
Commits
9b8009cf
Unverified
Commit
9b8009cf
authored
4 years ago
by
Kali Kaneko
Browse files
Options
Downloads
Patches
Plain Diff
[feat] cleanup temp dirs on quit
parent
2bcaa8e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pkg/backend/actions.go
+21
-0
21 additions, 0 deletions
pkg/backend/actions.go
pkg/backend/api.go
+4
-6
4 additions, 6 deletions
pkg/backend/api.go
pkg/backend/cleanup.go
+16
-0
16 additions, 0 deletions
pkg/backend/cleanup.go
with
41 additions
and
6 deletions
pkg/backend/actions.go
0 → 100644
+
21
−
0
View file @
9b8009cf
package
backend
import
(
"log"
"os"
)
func
startVPN
()
{
err
:=
ctx
.
bm
.
StartVPN
(
ctx
.
Provider
)
if
err
!=
nil
{
log
.
Println
(
err
)
os
.
Exit
(
1
)
}
}
func
stopVPN
()
{
err
:=
ctx
.
bm
.
StopVPN
()
if
err
!=
nil
{
log
.
Println
(
err
)
}
}
This diff is collapsed.
Click to expand it.
pkg/backend/api.go
+
4
−
6
View file @
9b8009cf
/* All the exported functions
live
here */
/* All the exported functions
should be added
here */
package
backend
...
...
@@ -24,7 +24,7 @@ func SwitchOff() {
}
func
Unblock
()
{
//TODO
//TODO
-
fmt
.
Println
(
"unblock... [not implemented]"
)
}
...
...
@@ -34,6 +34,7 @@ func Quit() {
ctx
.
cfg
.
SetUserStoppedVPN
(
true
)
stopVPN
()
}
cleanupTempDirs
()
}
func
DonateAccepted
()
{
...
...
@@ -51,10 +52,7 @@ func SubscribeToEvent(event string, f unsafe.Pointer) {
func
InitializeBitmaskContext
()
{
p
:=
bitmask
.
GetConfiguredProvider
()
initOnce
.
Do
(
func
()
{
initializeContext
(
p
.
Provider
,
p
.
AppName
)
})
initOnce
.
Do
(
func
()
{
initializeContext
(
p
.
Provider
,
p
.
AppName
)
})
go
ctx
.
updateStatus
()
go
func
()
{
...
...
This diff is collapsed.
Click to expand it.
pkg/backend/cleanup.go
0 → 100644
+
16
−
0
View file @
9b8009cf
package
backend
import
(
"log"
"os"
"path"
"path/filepath"
)
func
cleanupTempDirs
()
{
dirs
,
_
:=
filepath
.
Glob
(
path
.
Join
(
os
.
TempDir
(),
"leap-*"
))
for
_
,
d
:=
range
dirs
{
log
.
Println
(
"removing temp dir:"
,
d
)
os
.
RemoveAll
(
d
)
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment