File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import (
1818	"runtime" 
1919	"time" 
2020
21+ 	"suah.dev/protect" 
22+ 
2123	"github.com/yggdrasil-network/yggdrasil-go/src/address" 
2224)
2325
@@ -27,6 +29,10 @@ type keySet struct {
2729}
2830
2931func  main () {
32+ 	if  err  :=  protect .Pledge ("stdio" ); err  !=  nil  {
33+ 		panic (err )
34+ 	}
35+ 
3036	threads  :=  runtime .GOMAXPROCS (0 )
3137	fmt .Println ("Threads:" , threads )
3238	start  :=  time .Now ()
Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import (
1313	"strings" 
1414	"time" 
1515
16+ 	"suah.dev/protect" 
17+ 
1618	"github.com/olekukonko/tablewriter" 
1719	"github.com/yggdrasil-network/yggdrasil-go/src/admin" 
1820	"github.com/yggdrasil-network/yggdrasil-go/src/core" 
@@ -22,6 +24,11 @@ import (
2224)
2325
2426func  main () {
27+ 	// read config, speak DNS/TCP and/or over a UNIX socket 
28+ 	if  err  :=  protect .Pledge ("stdio rpath inet unix dns" ); err  !=  nil  {
29+ 		panic (err )
30+ 	}
31+ 
2532	// makes sure we can use defer and still return an error code to the OS 
2633	os .Exit (run ())
2734}
@@ -78,6 +85,11 @@ func run() int {
7885		panic (err )
7986	}
8087
88+ 	// config and socket are done, work without unprivileges 
89+ 	if  err  :=  protect .Pledge ("stdio" ); err  !=  nil  {
90+ 		panic (err )
91+ 	}
92+ 
8193	logger .Println ("Connected" )
8294	defer  conn .Close ()
8395
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments