mirror

Mirror free and open-source projects you like with minimal effort
git clone git://git.server.ky/slackcoder/mirror
Log | Files | Refs | README

mirror.go (1005B)


      1 package service
      2 
      3 import (
      4 	"bytes"
      5 
      6 	"git.server.ky/slackcoder/mirror/internal"
      7 	"github.com/BurntSushi/toml"
      8 )
      9 
     10 type Mirror struct {
     11 	Method      string        `toml:"method,omitempty"`
     12 	From        *internal.URL `toml:"from,omitempty"`
     13 	To          *internal.URL `toml:"to,omitempty"`
     14 	Description string        `toml:"description,omitempty"`
     15 	// See global configuration.
     16 	MaxInterval *Duration `toml:"max-interval"`
     17 	// See global configuration.
     18 	MinInterval *Duration `toml:"min-interval"`
     19 	// See global configuration.
     20 	StagingMethod string `toml:"staging-method,omitempty"`
     21 	// See global configuration.
     22 	StagingPath string `toml:"staging-path,omitempty"`
     23 	// See global configuration.
     24 	Verify string `toml:"verify,omitempty"`
     25 }
     26 
     27 func (m *Mirror) Equal(arg *Mirror) bool {
     28 	return m.Method == arg.Method && m.From.String() == arg.From.String() && m.To.String() == arg.To.String()
     29 }
     30 
     31 func (m *Mirror) String() string {
     32 	var buf bytes.Buffer
     33 
     34 	toml.NewEncoder(&buf).Encode(m)
     35 
     36 	return buf.String()
     37 }