mirror of
https://github.com/number571/hes.git
synced 2026-09-12 19:50:01 +05:00
add compile
This commit is contained in:
parent
93ffe80981
commit
bd6f8f4f70
9
.gitignore
vendored
9
.gitignore
vendored
@ -1,6 +1,7 @@
|
||||
client
|
||||
client.exe
|
||||
client_*_*
|
||||
server_*_*
|
||||
client.db
|
||||
server
|
||||
server.exe
|
||||
server.db
|
||||
client
|
||||
server
|
||||
compile
|
||||
|
||||
6
Makefile
6
Makefile
@ -1,3 +1,4 @@
|
||||
CC=gcc
|
||||
GC=go build
|
||||
GFILES=client.go cdatabase.go cmodels.go csessions.go gconsts.go server.go sdatabase.go sconfig.go
|
||||
.PHONY: default build clean
|
||||
@ -5,5 +6,8 @@ default: build
|
||||
build: $(GFILES)
|
||||
$(GC) client.go gconsts.go cdatabase.go cmodels.go csessions.go
|
||||
$(GC) server.go gconsts.go sdatabase.go sconfig.go
|
||||
build_all: compile.c $(GFILES)
|
||||
$(CC) -o compile compile.c
|
||||
./compile
|
||||
clean:
|
||||
rm -f client.db server.db server client
|
||||
rm -f client.db server.db server client compile client_*_* server_*_*
|
||||
|
||||
@ -48,7 +48,7 @@ var (
|
||||
func init() {
|
||||
go delOldSessionsByTime(1*time.Hour, 15*time.Minute)
|
||||
hesDefaultInit("localhost:7545")
|
||||
fmt.Println("Client is listening...\n")
|
||||
fmt.Printf("Client is listening [%s] ...\n\n", OPENADDR)
|
||||
}
|
||||
|
||||
func delOldSessionsByTime(deltime, period time.Duration) {
|
||||
@ -647,7 +647,7 @@ func writeEmails(addr string, rdata []byte) {
|
||||
}
|
||||
var servresp Resp
|
||||
resp, err := HTCLIENT.Post(
|
||||
"http://"+addr+"/email/send",
|
||||
addr+"/email/send",
|
||||
"application/json",
|
||||
bytes.NewReader(rdata),
|
||||
)
|
||||
@ -681,7 +681,7 @@ func readEmails(user *User, addr string) {
|
||||
pbhash := gp.HashPublicKey(client.PublicKey())
|
||||
// GET SIZE EMAILS
|
||||
resp, err := HTCLIENT.Post(
|
||||
"http://"+addr+"/email/recv",
|
||||
addr+"/email/recv",
|
||||
"application/json",
|
||||
bytes.NewReader(serialize(Req{
|
||||
Recv: pbhash,
|
||||
@ -709,7 +709,7 @@ func readEmails(user *User, addr string) {
|
||||
}
|
||||
for i, count := 1, 0; i <= size; i++ {
|
||||
resp, err := HTCLIENT.Post(
|
||||
"http://"+addr+"/email/recv",
|
||||
addr+"/email/recv",
|
||||
"application/json",
|
||||
bytes.NewReader(serialize(Req{
|
||||
Recv: pbhash,
|
||||
|
||||
47
compile.c
Normal file
47
compile.c
Normal file
@ -0,0 +1,47 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int main(void) {
|
||||
const char *compiler = "go build";
|
||||
const char *filenames[] = {"client", "server"};
|
||||
const char *platforms[] = {"windows", "linux"};
|
||||
const char *archs[] = {"amd64", "386", "arm"};
|
||||
const char *files[] = {
|
||||
"client.go cdatabase.go cmodels.go csessions.go gconsts.go",
|
||||
"server.go sconfig.go sdatabase.go gconsts.go"
|
||||
};
|
||||
|
||||
char command[BUFSIZ];
|
||||
char retfile[BUFSIZ];
|
||||
|
||||
for (int k = 0; k < sizeof(filenames)/sizeof(filenames[0]); ++k) {
|
||||
for (int i = 0; i < sizeof(platforms)/sizeof(platforms[0]); ++i) {
|
||||
#ifdef _WIN32
|
||||
snprintf(command, BUFSIZ, "set GOOS=%s", platforms[i]);
|
||||
printf("%s\n", command);
|
||||
system(command);
|
||||
#endif
|
||||
for (int j = 0; j < sizeof(archs)/sizeof(archs[0]); ++j) {
|
||||
#ifdef _WIN32
|
||||
snprintf(command, BUFSIZ, "set GOARCH=%s", archs[j]);
|
||||
printf("%s\n", command);
|
||||
system(command);
|
||||
#endif
|
||||
snprintf(retfile, BUFSIZ, "%s_%s_%s", filenames[k], platforms[i], archs[j]);
|
||||
if (strcmp(platforms[i], "windows") == 0) {
|
||||
strcat(retfile, ".exe");
|
||||
}
|
||||
#ifdef _WIN32
|
||||
snprintf(command, BUFSIZ, "%s -o %s %s", compiler, retfile, files[k]);
|
||||
#else
|
||||
snprintf(command, BUFSIZ, "GOOS=%s GOARCH=%s %s -o %s %s", platforms[i], archs[j], compiler, retfile, files[k]);
|
||||
#endif
|
||||
printf("%s\n", command);
|
||||
system(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -17,7 +17,7 @@ var (
|
||||
func init() {
|
||||
go delOldEmailsByTime(24*time.Hour, 6*time.Hour)
|
||||
hesDefaultInit("localhost:8080")
|
||||
fmt.Println("Server is listening...\n")
|
||||
fmt.Printf("Server is listening [%s] ...\n\n", OPENADDR)
|
||||
}
|
||||
|
||||
func delOldEmailsByTime(deltime, period time.Duration) {
|
||||
@ -116,7 +116,7 @@ func emailSendPage(w http.ResponseWriter, r *http.Request) {
|
||||
pasw := gp.HashSum([]byte(conn[1]))
|
||||
req.Macp = gp.Base64Encode(gp.EncryptAES(pasw, hash))
|
||||
resp, err := HTCLIENT.Post(
|
||||
"http://"+addr+"/email/send",
|
||||
addr+"/email/send",
|
||||
"application/json",
|
||||
bytes.NewReader(serialize(req)),
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user