Official cwtch.im peer and server implementations. https://cwtch.im
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
840 B

  1. package main
  2. import (
  3. cwtchserver "cwtch.im/cwtch/server"
  4. "git.openprivacy.ca/openprivacy/connectivity/tor"
  5. "git.openprivacy.ca/openprivacy/log"
  6. "os"
  7. "path"
  8. )
  9. const (
  10. serverConfigFile = "serverConfig.json"
  11. )
  12. func main() {
  13. log.AddEverythingFromPattern("server/app/main")
  14. log.AddEverythingFromPattern("server/server")
  15. configDir := os.Getenv("CWTCH_CONFIG_DIR")
  16. serverConfig := cwtchserver.LoadConfig(configDir, serverConfigFile)
  17. acn, err := tor.NewTorACN(path.Join(configDir, "tor"), "")
  18. if err != nil {
  19. log.Errorf("\nError connecting to Tor: %v\n", err)
  20. os.Exit(1)
  21. }
  22. defer acn.Close()
  23. server := new(cwtchserver.Server)
  24. log.Infoln("starting cwtch server...")
  25. // TODO load params from .cwtch/server.conf or command line flag
  26. // TODO: respond to HUP so t.Close is gracefully called
  27. server.Run(acn, serverConfig)
  28. }