forked from celestiaorg/celestia-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make the code works on Windows.
- Loading branch information
Showing
14 changed files
with
90 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ vendor | |
.bak | ||
.idea/ | ||
.vscode/ | ||
.fleet/ | ||
/celestia | ||
/cel-shed | ||
/cel-key | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
del -Recurse -Force .\build\* | ||
gofmt -e -s -w . | ||
go mod tidy | ||
$LDFLAGS="-ldflags=-X 'main.buildTime=$(date)' -X 'main.lastCommit=$(git rev-parse HEAD)' -X 'main.semanticVersion=$(git describe --tags --dirty=-dev)'" | ||
go build -o build/ ${LDFLAGS} ./cmd/celestia | ||
go build -o build/ ./cmd/cel-key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build darwin || freebsd || linux | ||
|
||
package keystore | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
// keyAccess checks whether file is not accessible by all users. | ||
func keyAccess(path string) error { | ||
st, _ := os.Stat(path) | ||
mode := st.Mode() | ||
if mode&0077 != 0 { | ||
return fmt.Errorf("required: 0600, got: %#o", mode) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
//go:build windows | ||
|
||
package keystore | ||
|
||
import ( | ||
"fmt" | ||
"golang.org/x/sys/windows" | ||
"unsafe" | ||
) | ||
|
||
// keyAccess checks whether file is not accessible by all users. | ||
func keyAccess(path string) error { | ||
|
||
// Check the file's DACL | ||
securityDescriptor, err := windows.GetNamedSecurityInfo(path, windows.SE_FILE_OBJECT, windows.DACL_SECURITY_INFORMATION) | ||
if err != nil { | ||
return fmt.Errorf("Error getting file's DACL: %v\n", err) | ||
} | ||
defer func() { | ||
if err != nil { | ||
_, _ = windows.LocalFree((windows.Handle)(unsafe.Pointer(securityDescriptor))) | ||
} | ||
}() | ||
_, _, err = securityDescriptor.DACL() | ||
if err != nil { | ||
return fmt.Errorf("File is too Open with no DACL: %v\n", err) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.