go-peer/docs
2024-10-16 07:43:23 +07:00
..
abstract_anonymous_networks.docx update 2024-04-25 08:11:52 +07:00
abstract_anonymous_networks.pdf update 2024-08-09 11:09:20 +07:00
decentralized_key_exchange_protocol.docx update 2024-02-18 06:21:58 +07:00
decentralized_key_exchange_protocol.pdf update 2024-02-18 06:21:58 +07:00
general_theory_of_anonymous_communications.pdf update 2023-10-17 05:32:23 +07:00
grok_anonymity.pdf update 2024-01-07 19:30:04 +07:00
grok_anonymity.pptx update 2024-01-07 19:30:04 +07:00
monolithic_cryptographic_protocol.docx update 2023-09-28 12:53:05 +07:00
monolithic_cryptographic_protocol.pdf update 2023-09-28 12:53:05 +07:00
README.md update 2024-10-16 07:43:23 +07:00
theory_of_the_structure_of_hidden_systems.docx update 2024-10-09 08:34:52 +07:00
theory_of_the_structure_of_hidden_systems.pdf update 2024-10-09 08:34:52 +07:00

Docs

Material

1. Papers

  1. Theory of the structure of hidden systems
  2. Monolithic cryptographic protocol
  3. Abstract anonymous networks
  4. Decentralized key exchange protocol

Also, the composition of these works can be found in the book The general theory of anonymous communications. This book can be purchased in a tangible form on the Ozon and Wildberries marketplaces. You can download the book in digital form for free here.

2. Presentations

  1. Grok anonymity

3. Videos

  1. DC/EI/QB networks & HLM

Code style

In the course of editing the project, some code styles may be added, some edited. Therefore, the current state of the project may not fully adhere to the code style, but you need to strive for it.

1. Prefixes

The name of the global constants must begin with the prefix 'c' (internal) or 'C' (external).

const (
    cInternalConst = 1
    CExternalConst = 2
)

The name of the global variables must begin with the prefix 'g' (internal) or 'G' (external). The exception is errors with the prefix 'err' or 'Err'.

var (
    gInternalVariable = 1
    GExternalVariable = 2
)

The name of the global structs must begin with the prefix 's' (internal) or 'S' (external). Also fields in the structure must begin with the prefix 'f' or 'F'.

type (
    sInternalStruct struct{
        fInternalField int 
    }
    SExternalStruct struct{
        FExternalField int
    }
)

The name of the global interfaces must begin with the prefix 'i' (internal) or 'I' (external). Also type functions must begin with the prefix 'i' or 'I'.

type (
    iInternalInterface interface{}
    IExternalInterface interface{}
)

type (
    iInternalFunc func()
    iExternalFunc func()
)

The name of the function parameters must begin with the prefix 'p'. Also method's object must be equal 'p'. The exception of this code style is test files.

func f(pK, pV int) {}
func (p *sObject) m() {}

The name of the global constants, variables, structures, fields, interfaces in the test environment must begin with prefix 't' (internal) or 'T' (external).

const (
    tcInternalConst = 1
    TcExternalConst = 2
)

var (
    tgInternalVariable = 1
    TgExternalVariable = 2
)

type (
    tsInternalStruct struct{
        tfInternalField int 
    }
    TsExternalStruct struct{
        TfInternalField int 
    }
)

type (
    tiInternalInterface interface{}
    TiExternalInterface interface{}
)

type (
    tiInternalFunc func()
    TiExternalFunc func()
)

2. Function / Methods names

Functions and methods should consist of two parts, where the first is a verb, the second is a noun. Standart names: Get, Set, Add, Del and etc. Example

type IClient interface {
	GetIndex() (string, error)

	GetPubKey() (asymmetric.IPubKey, error)
	SetPrivKey(asymmetric.IPrivKey) error

	GetOnlines() ([]string, error)
	DelOnline(string) error

	GetFriends() (map[string]asymmetric.IPubKey, error)
	AddFriend(string, asymmetric.IPubKey) error
	DelFriend(string) error

	GetConnections() ([]string, error)
	AddConnection(string) error
	DelConnection(string) error

	BroadcastRequest(asymmetric.IPubKey, request.IRequest) error
	FetchRequest(asymmetric.IPubKey, request.IRequest) ([]byte, error)
}

3. If blocks

The following is allowed.

if err := f(); err != nil {
    // ...
}

err := g(
    a,
    b,
    c,
)
if err != nil {
    // ...
}

The following is not allowed.

if v {
    // ...
} else { /* eradicate the 'else' block */
    // ...
}

err := f() /* may be in if block */
if err != nil {
    // ...
}

if err := g(
    a,
    b,
    c,
); err != nil { /* not allowed multiply line-args in if block */
    // ...
}

4. Interface declaration

When a type is bound to an interface, it must be explicitly specified like this.

var (
	_ types.IRunner = &sApp{}
)

5. Calling functions/methods

External simple getter functions/methods should not be used inside the package.

func (p *sObject) GetSettings() ISettings {
	return p.fSettings
}
func (p *sObject) GetValue() IValue {
    p.fMutex.Lock()
    defer p.fMutex.Unlock()

    return p.fValue
}
...
func (p *sObject) DoSomething() {
	_ = p.fSettings // correct
    _ = p.GetSettings() // incorrect

    // incorrect
    p.fMutex.Lock()
    _ = p.fValue
    p.fMutex.Unlock()

    _ = p.GetValue() // correct
}

6. Args/Returns interfaces

It is not allowed to use global structures in function arguments or when returning. Interfaces should be used instead of structures.

The following is allowed.

func doObject(_ IObject) {}
func newObject() IObject {}

The following is not allowed.

func doObject(_ *SObject) {}
func newObject() *SObject {}