adding dotfiles
This commit is contained in:
parent
f9465bb408
commit
ce4d2b94a2
|
@ -0,0 +1,118 @@
|
|||
include "/usr/X11R6/share/X11/locale/en_US.UTF-8/Compose"
|
||||
|
||||
# Used for pollen
|
||||
<Multi_key> <l> <l> : "◊" U25ca # ◊ LOZENGE
|
||||
|
||||
# LAMBDA LAMBDA LAMBDA
|
||||
<Multi_key> <period> <backslash> : "λ" U03BB # GREEK SMALL LETTER LAMBDA
|
||||
|
||||
# Greek letters
|
||||
# Source: https://gist.githubusercontent.com/carlobaldassi/8951743/raw/2b587c8147603d395bf2ec221eee348f27dabaa8/XCompose_greek
|
||||
<Multi_key> <space> <a> : "α" U03B1 # GREEK SMALL LETTER ALPHA
|
||||
<Multi_key> <a> <space> : "α" U03B1 # GREEK SMALL LETTER ALPHA
|
||||
<Multi_key> <space> <b> : "β" U03B2 # GREEK SMALL LETTER BETA
|
||||
<Multi_key> <b> <space> : "β" U03B2 # GREEK SMALL LETTER BETA
|
||||
<Multi_key> <space> <c> : "ξ" U03BE # GREEK SMALL LETTER XI
|
||||
<Multi_key> <c> <space> : "ξ" U03BE # GREEK SMALL LETTER XI
|
||||
<Multi_key> <space> <d> : "δ" U03B4 # GREEK SMALL LETTER DELTA
|
||||
<Multi_key> <d> <space> : "δ" U03B4 # GREEK SMALL LETTER DELTA
|
||||
<Multi_key> <space> <e> : "ε" U03B5 # GREEK SMALL LETTER EPSILON
|
||||
<Multi_key> <e> <space> : "ε" U03B5 # GREEK SMALL LETTER EPSILON
|
||||
<Multi_key> <space> <f> : "φ" U03C6 # GREEK SMALL LETTER PHI
|
||||
<Multi_key> <f> <space> : "φ" U03C6 # GREEK SMALL LETTER PHI
|
||||
<Multi_key> <space> <g> : "γ" U03B3 # GREEK SMALL LETTER GAMMA
|
||||
<Multi_key> <g> <space> : "γ" U03B3 # GREEK SMALL LETTER GAMMA
|
||||
<Multi_key> <space> <h> : "θ" U03B8 # GREEK SMALL LETTER THETA
|
||||
<Multi_key> <h> <space> : "θ" U03B8 # GREEK SMALL LETTER THETA
|
||||
<Multi_key> <space> <i> : "ι" U03B9 # GREEK SMALL LETTER ΙΟΤΑ
|
||||
<Multi_key> <i> <space> : "ι" U03B9 # GREEK SMALL LETTER ΙΟΤΑ
|
||||
<Multi_key> <space> <k> : "κ" U03BA # GREEK SMALL LETTER KAPPA
|
||||
<Multi_key> <k> <space> : "κ" U03BA # GREEK SMALL LETTER KAPPA
|
||||
<Multi_key> <space> <l> : "λ" U03BB # GREEK SMALL LETTER LAMBDA
|
||||
<Multi_key> <l> <space> : "λ" U03BB # GREEK SMALL LETTER LAMBDA
|
||||
<Multi_key> <space> <m> : "μ" U03BC # GREEK SMALL LETTER MU
|
||||
<Multi_key> <m> <space> : "μ" U03BC # GREEK SMALL LETTER MU
|
||||
<Multi_key> <space> <n> : "ν" U03BD # GREEK SMALL LETTER NU
|
||||
<Multi_key> <n> <space> : "ν" U03BD # GREEK SMALL LETTER NU
|
||||
<Multi_key> <space> <o> : "ο" U03BF # GREEK SMALL LETTER OMICRON
|
||||
<Multi_key> <o> <space> : "ο" U03BF # GREEK SMALL LETTER OMICRON
|
||||
<Multi_key> <space> <p> : "π" U03C0 # GREEK SMALL LETTER PI
|
||||
<Multi_key> <p> <space> : "π" U03C0 # GREEK SMALL LETTER PI
|
||||
<Multi_key> <space> <q> : "ψ" U03C8 # GREEK SMALL LETTER PSI
|
||||
<Multi_key> <q> <space> : "ψ" U03C8 # GREEK SMALL LETTER PSI
|
||||
<Multi_key> <space> <r> : "ρ" U03C1 # GREEK SMALL LETTER RHO
|
||||
<Multi_key> <r> <space> : "ρ" U03C1 # GREEK SMALL LETTER RHO
|
||||
<Multi_key> <space> <s> : "σ" U03C3 # GREEK SMALL LETTER SIGMA
|
||||
<Multi_key> <s> <space> : "σ" U03C3 # GREEK SMALL LETTER SIGMA
|
||||
<Multi_key> <space> <t> : "τ" U03C4 # GREEK SMALL LETTER TAU
|
||||
<Multi_key> <t> <space> : "τ" U03C4 # GREEK SMALL LETTER TAU
|
||||
<Multi_key> <space> <u> : "υ" U03C5 # GREEK SMALL LETTER UPSILON
|
||||
<Multi_key> <u> <space> : "υ" U03C5 # GREEK SMALL LETTER UPSILON
|
||||
<Multi_key> <space> <v> : "ς" U03C2 # GREEK SMALL LETTER FINAL SIGMA
|
||||
<Multi_key> <v> <space> : "ς" U03C2 # GREEK SMALL LETTER FINAL SIGMA
|
||||
<Multi_key> <space> <w> : "ω" U03C9 # GREEK SMALL LETTER OMEGA
|
||||
<Multi_key> <w> <space> : "ω" U03C9 # GREEK SMALL LETTER OMEGA
|
||||
<Multi_key> <space> <x> : "χ" U03C7 # GREEK SMALL LETTER CHI
|
||||
<Multi_key> <x> <space> : "χ" U03C7 # GREEK SMALL LETTER CHI
|
||||
<Multi_key> <space> <y> : "η" U03B7 # GREEK SMALL LETTER ΕΤΑ
|
||||
<Multi_key> <y> <space> : "η" U03B7 # GREEK SMALL LETTER ΕΤΑ
|
||||
<Multi_key> <space> <z> : "ζ" U03B6 # GREEK SMALL LETTER ZETA
|
||||
<Multi_key> <z> <space> : "ζ" U03B6 # GREEK SMALL LETTER ZETA
|
||||
|
||||
# Capital greek letters.
|
||||
<Multi_key> <space> <A> : "Α" U0391 # GREEK CAPITAL LETTER ALPHA
|
||||
<Multi_key> <A> <space> : "Α" U0391 # GREEK CAPITAL LETTER ALPHA
|
||||
<Multi_key> <space> <B> : "Β" U0392 # GREEK CAPITAL LETTER BETA
|
||||
<Multi_key> <B> <space> : "Β" U0392 # GREEK CAPITAL LETTER BETA
|
||||
<Multi_key> <space> <C> : "Ξ" U039E # GREEK CAPITAL LETTER XI
|
||||
<Multi_key> <C> <space> : "Ξ" U039E # GREEK CAPITAL LETTER XI
|
||||
<Multi_key> <space> <D> : "Δ" U0394 # GREEK CAPITAL LETTER DELTA
|
||||
<Multi_key> <D> <space> : "Δ" U0394 # GREEK CAPITAL LETTER DELTA
|
||||
<Multi_key> <space> <E> : "Ε" U0395 # GREEK CAPITAL LETTER EPSILON
|
||||
<Multi_key> <E> <space> : "Ε" U0395 # GREEK CAPITAL LETTER EPSILON
|
||||
<Multi_key> <space> <F> : "Φ" U03A6 # GREEK CAPITAL LETTER PHI
|
||||
<Multi_key> <F> <space> : "Φ" U03A6 # GREEK CAPITAL LETTER PHI
|
||||
<Multi_key> <space> <G> : "Γ" U0393 # GREEK CAPITAL LETTER GAMMA
|
||||
<Multi_key> <G> <space> : "Γ" U0393 # GREEK CAPITAL LETTER GAMMA
|
||||
<Multi_key> <space> <H> : "Θ" U0398 # GREEK CAPITAL LETTER THETA
|
||||
<Multi_key> <H> <space> : "Θ" U0398 # GREEK CAPITAL LETTER THETA
|
||||
<Multi_key> <space> <I> : "Ι" U0399 # GREEK CAPITAL LETTER ΙΟΤΑ
|
||||
<Multi_key> <I> <space> : "Ι" U0399 # GREEK CAPITAL LETTER ΙΟΤΑ
|
||||
<Multi_key> <space> <K> : "Κ" U039A # GREEK CAPITAL LETTER KAPPA
|
||||
<Multi_key> <K> <space> : "Κ" U039A # GREEK CAPITAL LETTER KAPPA
|
||||
<Multi_key> <space> <L> : "Λ" U039B # GREEK CAPITAL LETTER LAMBDA
|
||||
<Multi_key> <L> <space> : "Λ" U039B # GREEK CAPITAL LETTER LAMBDA
|
||||
<Multi_key> <space> <M> : "Μ" U039C # GREEK CAPITAL LETTER MU
|
||||
<Multi_key> <M> <space> : "Μ" U039C # GREEK CAPITAL LETTER MU
|
||||
<Multi_key> <space> <N> : "Ν" U039D # GREEK CAPITAL LETTER NU
|
||||
<Multi_key> <N> <space> : "Ν" U039D # GREEK CAPITAL LETTER NU
|
||||
<Multi_key> <space> <O> : "Ο" U039F # GREEK CAPITAL LETTER OMICRON
|
||||
<Multi_key> <O> <space> : "Ο" U039F # GREEK CAPITAL LETTER OMICRON
|
||||
<Multi_key> <space> <P> : "Π" U03A0 # GREEK CAPITAL LETTER PI
|
||||
<Multi_key> <P> <space> : "Π" U03A0 # GREEK CAPITAL LETTER PI
|
||||
<Multi_key> <space> <Q> : "Ψ" U03A8 # GREEK CAPITAL LETTER PSI
|
||||
<Multi_key> <Q> <space> : "Ψ" U03A8 # GREEK CAPITAL LETTER PSI
|
||||
<Multi_key> <space> <R> : "Ρ" U03A1 # GREEK CAPITAL LETTER RHO
|
||||
<Multi_key> <R> <space> : "Ρ" U03A1 # GREEK CAPITAL LETTER RHO
|
||||
<Multi_key> <space> <S> : "Σ" U03A3 # GREEK CAPITAL LETTER SIGMA
|
||||
<Multi_key> <S> <space> : "Σ" U03A3 # GREEK CAPITAL LETTER SIGMA
|
||||
<Multi_key> <space> <T> : "Τ" U03A4 # GREEK CAPITAL LETTER TAU
|
||||
<Multi_key> <T> <space> : "Τ" U03A4 # GREEK CAPITAL LETTER TAU
|
||||
<Multi_key> <space> <U> : "Υ" U03A5 # GREEK CAPITAL LETTER UPSILON
|
||||
<Multi_key> <U> <space> : "Υ" U03A5 # GREEK CAPITAL LETTER UPSILON
|
||||
<Multi_key> <space> <V> : "Σ" U03A3 # GREEK CAPITAL LETTER SIGMA
|
||||
<Multi_key> <V> <space> : "Σ" U03A3 # GREEK CAPITAL LETTER SIGMA
|
||||
<Multi_key> <space> <W> : "Ω" U03A9 # GREEK CAPITAL LETTER OMEGA
|
||||
<Multi_key> <W> <space> : "Ω" U03A9 # GREEK CAPITAL LETTER OMEGA
|
||||
<Multi_key> <space> <X> : "Χ" U03A7 # GREEK CAPITAL LETTER CHI
|
||||
<Multi_key> <X> <space> : "Χ" U03A7 # GREEK CAPITAL LETTER CHI
|
||||
<Multi_key> <space> <Y> : "Η" U0397 # GREEK CAPITAL LETTER ΕΤΑ
|
||||
<Multi_key> <Y> <space> : "Η" U0397 # GREEK CAPITAL LETTER ΕΤΑ
|
||||
<Multi_key> <space> <Z> : "Ζ" U0396 # GREEK CAPITAL LETTER ZETA
|
||||
<Multi_key> <Z> <space> : "Ζ" U0396 # GREEK CAPITAL LETTER ZETA
|
||||
|
||||
<Multi_key> <a> <v> : "Ɐ" U2200 # FOR ALL
|
||||
<Multi_key> <E> <E> : "∃" U2203 # THERE EXISTS
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
# Beware! This file is rewritten by htop when settings are changed in the interface.
|
||||
# The parser is also very primitive, and not human-friendly.
|
||||
fields=0 48 17 18 38 39 40 2 46 47 49 1
|
||||
sort_key=46
|
||||
sort_direction=1
|
||||
hide_threads=0
|
||||
hide_kernel_threads=1
|
||||
hide_userland_threads=0
|
||||
shadow_other_users=0
|
||||
show_thread_names=0
|
||||
show_program_path=1
|
||||
highlight_base_name=0
|
||||
highlight_megabytes=1
|
||||
highlight_threads=1
|
||||
tree_view=0
|
||||
header_margin=1
|
||||
detailed_cpu_time=0
|
||||
cpu_count_from_zero=0
|
||||
update_process_names=0
|
||||
account_guest_in_cpu_meter=0
|
||||
color_scheme=0
|
||||
delay=15
|
||||
left_meters=AllCPUs Memory Swap
|
||||
left_meter_modes=1 1 1
|
||||
right_meters=Tasks LoadAverage Uptime Memory Swap
|
||||
right_meter_modes=2 2 2 2 2
|
|
@ -0,0 +1,184 @@
|
|||
# This file has been auto-generated by i3-config-wizard(1).
|
||||
# It will not be overwritten, so edit it as you like.
|
||||
#
|
||||
# Should you change your keyboard layout some time, delete
|
||||
# this file and re-run i3-config-wizard(1).
|
||||
#
|
||||
|
||||
# i3 config file (v4)
|
||||
#
|
||||
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
|
||||
|
||||
set $mod Mod4
|
||||
|
||||
# Font for window titles. Will also be used by the bar unless a different font
|
||||
# is used in the bar {} block below.
|
||||
font pango:monospace 8
|
||||
|
||||
# This font is widely installed, provides lots of unicode glyphs, right-to-left
|
||||
# text rendering and scalability on retina/hidpi displays (thanks to pango).
|
||||
#font pango:DejaVu Sans Mono 8
|
||||
|
||||
# The combination of xss-lock, nm-applet and pactl is a popular choice, so
|
||||
# they are included here as an example. Modify as you see fit.
|
||||
|
||||
# xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the
|
||||
# screen before suspend. Use loginctl lock-session to lock your screen.
|
||||
exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork
|
||||
|
||||
# NetworkManager is the most popular way to manage wireless networks on Linux,
|
||||
# and nm-applet is a desktop environment-independent system tray GUI for it.
|
||||
exec --no-startup-id nm-applet
|
||||
|
||||
# Use pactl to adjust volume in PulseAudio.
|
||||
set $refresh_i3status killall -SIGUSR1 i3status
|
||||
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status
|
||||
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status
|
||||
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status
|
||||
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
|
||||
|
||||
# Use Mouse+$mod to drag floating windows to their wanted position
|
||||
floating_modifier $mod
|
||||
|
||||
# start a terminal
|
||||
bindsym $mod+Return exec i3-sensible-terminal
|
||||
|
||||
# kill focused window
|
||||
bindsym $mod+Shift+q kill
|
||||
|
||||
# start dmenu (a program launcher)
|
||||
bindsym $mod+d exec dmenu_run
|
||||
# There also is the (new) i3-dmenu-desktop which only displays applications
|
||||
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
|
||||
# installed.
|
||||
# bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
|
||||
|
||||
# change focus
|
||||
bindsym $mod+j focus left
|
||||
bindsym $mod+k focus down
|
||||
bindsym $mod+l focus up
|
||||
bindsym $mod+semicolon focus right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Left focus left
|
||||
bindsym $mod+Down focus down
|
||||
bindsym $mod+Up focus up
|
||||
bindsym $mod+Right focus right
|
||||
|
||||
# move focused window
|
||||
bindsym $mod+Shift+j move left
|
||||
bindsym $mod+Shift+k move down
|
||||
bindsym $mod+Shift+l move up
|
||||
bindsym $mod+Shift+semicolon move right
|
||||
|
||||
# alternatively, you can use the cursor keys:
|
||||
bindsym $mod+Shift+Left move left
|
||||
bindsym $mod+Shift+Down move down
|
||||
bindsym $mod+Shift+Up move up
|
||||
bindsym $mod+Shift+Right move right
|
||||
|
||||
# split in horizontal orientation
|
||||
bindsym $mod+h split h
|
||||
|
||||
# split in vertical orientation
|
||||
bindsym $mod+v split v
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
bindsym $mod+f fullscreen toggle
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
bindsym $mod+s layout stacking
|
||||
bindsym $mod+w layout tabbed
|
||||
bindsym $mod+e layout toggle split
|
||||
|
||||
# toggle tiling / floating
|
||||
bindsym $mod+Shift+space floating toggle
|
||||
|
||||
# change focus between tiling / floating windows
|
||||
bindsym $mod+space focus mode_toggle
|
||||
|
||||
# focus the parent container
|
||||
bindsym $mod+a focus parent
|
||||
|
||||
# focus the child container
|
||||
#bindsym $mod+d focus child
|
||||
|
||||
# Define names for default workspaces for which we configure key bindings later on.
|
||||
# We use variables to avoid repeating the names in multiple places.
|
||||
set $ws1 "1"
|
||||
set $ws2 "2"
|
||||
set $ws3 "3"
|
||||
set $ws4 "4"
|
||||
set $ws5 "5"
|
||||
set $ws6 "6"
|
||||
set $ws7 "7"
|
||||
set $ws8 "8"
|
||||
set $ws9 "9"
|
||||
set $ws10 "10"
|
||||
|
||||
# switch to workspace
|
||||
bindsym $mod+1 workspace number $ws1
|
||||
bindsym $mod+2 workspace number $ws2
|
||||
bindsym $mod+3 workspace number $ws3
|
||||
bindsym $mod+4 workspace number $ws4
|
||||
bindsym $mod+5 workspace number $ws5
|
||||
bindsym $mod+6 workspace number $ws6
|
||||
bindsym $mod+7 workspace number $ws7
|
||||
bindsym $mod+8 workspace number $ws8
|
||||
bindsym $mod+9 workspace number $ws9
|
||||
bindsym $mod+0 workspace number $ws10
|
||||
|
||||
# move focused container to workspace
|
||||
bindsym $mod+Shift+1 move container to workspace number $ws1
|
||||
bindsym $mod+Shift+2 move container to workspace number $ws2
|
||||
bindsym $mod+Shift+3 move container to workspace number $ws3
|
||||
bindsym $mod+Shift+4 move container to workspace number $ws4
|
||||
bindsym $mod+Shift+5 move container to workspace number $ws5
|
||||
bindsym $mod+Shift+6 move container to workspace number $ws6
|
||||
bindsym $mod+Shift+7 move container to workspace number $ws7
|
||||
bindsym $mod+Shift+8 move container to workspace number $ws8
|
||||
bindsym $mod+Shift+9 move container to workspace number $ws9
|
||||
bindsym $mod+Shift+0 move container to workspace number $ws10
|
||||
|
||||
# reload the configuration file
|
||||
bindsym $mod+Shift+c reload
|
||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||
bindsym $mod+Shift+r restart
|
||||
# exit i3 (logs you out of your X session)
|
||||
bindsym $mod+Shift+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'"
|
||||
|
||||
# resize window (you can also use the mouse for that)
|
||||
mode "resize" {
|
||||
# These bindings trigger as soon as you enter the resize mode
|
||||
|
||||
# Pressing left will shrink the window’s width.
|
||||
# Pressing right will grow the window’s width.
|
||||
# Pressing up will shrink the window’s height.
|
||||
# Pressing down will grow the window’s height.
|
||||
bindsym j resize shrink width 10 px or 10 ppt
|
||||
bindsym k resize grow height 10 px or 10 ppt
|
||||
bindsym l resize shrink height 10 px or 10 ppt
|
||||
bindsym semicolon resize grow width 10 px or 10 ppt
|
||||
|
||||
# same bindings, but for the arrow keys
|
||||
bindsym Left resize shrink width 10 px or 10 ppt
|
||||
bindsym Down resize grow height 10 px or 10 ppt
|
||||
bindsym Up resize shrink height 10 px or 10 ppt
|
||||
bindsym Right resize grow width 10 px or 10 ppt
|
||||
|
||||
# back to normal: Enter or Escape or $mod+r
|
||||
bindsym Return mode "default"
|
||||
bindsym Escape mode "default"
|
||||
bindsym $mod+r mode "default"
|
||||
}
|
||||
|
||||
bindsym $mod+r mode "resize"
|
||||
|
||||
# Start i3bar to display a workspace bar (plus the system information i3status
|
||||
# finds out, if available)
|
||||
bar {
|
||||
status_command i3status
|
||||
}
|
||||
|
||||
# make sure qemu is floating
|
||||
for_window [title="^QEMU*"] floating enable
|
|
@ -0,0 +1,65 @@
|
|||
general {
|
||||
output_format = "i3bar"
|
||||
colors = true
|
||||
interval = 5
|
||||
}
|
||||
|
||||
order += "disk /home"
|
||||
order += "disk /usr/local"
|
||||
order += "wireless iwm0"
|
||||
order += "battery 0"
|
||||
order += "cpu_temperature 0"
|
||||
order += "load"
|
||||
order += "tztime local"
|
||||
|
||||
wireless iwm0 {
|
||||
format_up = "W: [%essid] %ip"
|
||||
format_down = "W: down"
|
||||
}
|
||||
|
||||
ethernet eth0 {
|
||||
format_up = "E: %ip (%speed)"
|
||||
format_down = "E: down"
|
||||
}
|
||||
|
||||
battery 0 {
|
||||
format = "%status %percentage %remaining %emptytime"
|
||||
format_down = "No battery"
|
||||
status_chr = "CHR"
|
||||
status_bat = "BAT"
|
||||
status_unk = "UNK"
|
||||
status_full = "FULL"
|
||||
path = "/sys/class/power_supply/BAT%d/uevent"
|
||||
low_threshold = 10
|
||||
}
|
||||
|
||||
tztime local {
|
||||
format = "%Y-%m-%d %H:%M:%S"
|
||||
}
|
||||
|
||||
load {
|
||||
format = "%5min"
|
||||
}
|
||||
|
||||
cpu_temperature 0 {
|
||||
format = "T: %degrees °C"
|
||||
path = "/sys/devices/platform/coretemp.0/temp1_input"
|
||||
}
|
||||
|
||||
memory {
|
||||
format = "%used"
|
||||
threshold_degraded = "10%"
|
||||
format_degraded = "MEMORY: %free"
|
||||
}
|
||||
|
||||
disk "/home" {
|
||||
format = "%free"
|
||||
}
|
||||
|
||||
disk "/usr/local" {
|
||||
format = "%free"
|
||||
}
|
||||
|
||||
read_file uptime {
|
||||
path = "/proc/uptime"
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
|
||||
===========================================================================
|
||||
This is a list of the latest RFCs only.
|
||||
To get the full list of RFCs, please look up rfc-index.txt
|
||||
===========================================================================
|
||||
|
||||
8197 A SIP Response Code for Unwanted Calls. H. Schulzrinne. July 2017.
|
||||
(Format: TXT=19114 bytes) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8197)
|
||||
|
||||
8198 Aggressive Use of DNSSEC-Validated Cache. K. Fujiwara, A. Kato, W.
|
||||
Kumari. July 2017. (Format: TXT=27918 bytes) (Updates RFC4035)
|
||||
(Status: PROPOSED STANDARD) (DOI: 10.17487/RFC8198)
|
||||
|
||||
8199 YANG Module Classification. D. Bogdanovic, B. Claise, C. Moberg.
|
||||
July 2017. (Format: TXT=23080 bytes) (Status: INFORMATIONAL) (DOI:
|
||||
10.17487/RFC8199)
|
||||
|
||||
8200 Internet Protocol, Version 6 (IPv6) Specification. S. Deering, R.
|
||||
Hinden. July 2017. (Format: TXT=93658 bytes) (Obsoletes RFC2460)
|
||||
(Also STD0086) (Status: INTERNET STANDARD) (DOI: 10.17487/RFC8200)
|
||||
|
||||
8201 Path MTU Discovery for IP version 6. J. McCann, S. Deering, J.
|
||||
Mogul, R. Hinden, Ed.. July 2017. (Format: TXT=42751 bytes)
|
||||
(Obsoletes RFC1981) (Also STD0087) (Status: INTERNET STANDARD) (DOI:
|
||||
10.17487/RFC8201)
|
||||
|
||||
8202 IS-IS Multi-Instance. L. Ginsberg, S. Previdi, W. Henderickx. June
|
||||
2017. (Format: TXT=35114 bytes) (Obsoletes RFC6822) (Status:
|
||||
PROPOSED STANDARD) (DOI: 10.17487/RFC8202)
|
||||
|
||||
8203 BGP Administrative Shutdown Communication. J. Snijders, J. Heitz, J.
|
||||
Scudder. July 2017. (Format: TXT=12532 bytes) (Updates RFC4486)
|
||||
(Status: PROPOSED STANDARD) (DOI: 10.17487/RFC8203)
|
||||
|
||||
8212 Default External BGP (EBGP) Route Propagation Behavior without
|
||||
Policies. J. Mauch, J. Snijders, G. Hankins. July 2017. (Format:
|
||||
TXT=12552 bytes) (Updates RFC4271) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8212)
|
||||
|
||||
8213 Security of Messages Exchanged between Servers and Relay Agents. B.
|
||||
Volz, Y. Pal. August 2017. (Format: TXT=17657 bytes) (Status:
|
||||
PROPOSED STANDARD) (DOI: 10.17487/RFC8213)
|
||||
|
||||
8214 Virtual Private Wire Service Support in Ethernet VPN. S. Boutros, A.
|
||||
Sajassi, S. Salam, J. Drake, J. Rabadan. August 2017. (Format:
|
||||
TXT=34563 bytes) (Status: PROPOSED STANDARD) (DOI: 10.17487/RFC8214)
|
||||
|
||||
8215 Local-Use IPv4/IPv6 Translation Prefix. T. Anderson. August 2017.
|
||||
(Format: TXT=14846 bytes) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8215)
|
||||
|
||||
8217 Clarifications for When to Use the name-addr Production in SIP
|
||||
Messages. R. Sparks. August 2017. (Format: TXT=12829 bytes) (Updates
|
||||
RFC3261, RFC3325, RFC3515, RFC3892, RFC4508, RFC5002, RFC5318,
|
||||
RFC5360, RFC5502) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8217)
|
||||
|
||||
8218 Multipath Extension for the Optimized Link State Routing Protocol
|
||||
Version 2 (OLSRv2). J. Yi, B. Parrein. August 2017. (Format:
|
||||
TXT=56286 bytes) (Status: EXPERIMENTAL) (DOI: 10.17487/RFC8218)
|
||||
|
||||
8219 Benchmarking Methodology for IPv6 Transition Technologies. M.
|
||||
Georgescu, L. Pislaru, G. Lencse. August 2017. (Format: TXT=66085
|
||||
bytes) (Status: INFORMATIONAL) (DOI: 10.17487/RFC8219)
|
||||
|
||||
8227 MPLS-TP Shared-Ring Protection (MSRP) Mechanism for Ring Topology.
|
||||
W. Cheng, L. Wang, H. Li, H. van Helvoort, J. Dong. August 2017.
|
||||
(Format: TXT=128880 bytes) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8227)
|
||||
|
||||
8228 Guidance on Designing Label Generation Rulesets (LGRs) Supporting
|
||||
Variant Labels. A. Freytag. August 2017. (Format: TXT=50900 bytes)
|
||||
(Status: INFORMATIONAL) (DOI: 10.17487/RFC8228)
|
||||
|
||||
8229 TCP Encapsulation of IKE and IPsec Packets. T. Pauly, S. Touati, R.
|
||||
Mantha. August 2017. (Format: TXT=56294 bytes) (Status: PROPOSED
|
||||
STANDARD) (DOI: 10.17487/RFC8229)
|
||||
|
||||
8234 Updates to MPLS Transport Profile (MPLS-TP) Linear Protection in
|
||||
Automatic Protection Switching (APS) Mode. J. Ryoo, T. Cheung, H.
|
||||
van Helvoort, I. Busi, G. Wen. August 2017. (Format: TXT=16898
|
||||
bytes) (Updates RFC7271) (Status: PROPOSED STANDARD) (DOI:
|
||||
10.17487/RFC8234)
|
||||
|
||||
===========================================================================
|
||||
- This file last updated Wed Aug 30 02:30:01 PDT 2017
|
||||
|
|
@ -0,0 +1,451 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group S. Hanks
|
||||
Request for Comments: 1701 NetSmiths, Ltd.
|
||||
Category: Informational T. Li
|
||||
D. Farinacci
|
||||
P. Traina
|
||||
cisco Systems
|
||||
October 1994
|
||||
|
||||
|
||||
Generic Routing Encapsulation (GRE)
|
||||
|
||||
Status of this Memo
|
||||
|
||||
|
||||
This memo provides information for the Internet community. This memo
|
||||
does not specify an Internet standard of any kind. Distribution of
|
||||
this memo is unlimited.
|
||||
|
||||
Abstract
|
||||
|
||||
This document specifies a protocol for performing encapsulation of an
|
||||
arbitrary network layer protocol over another arbitrary network layer
|
||||
protocol.
|
||||
|
||||
Introduction
|
||||
|
||||
A number of different proposals [RFC 1234, RFC 1226] currently exist
|
||||
for the encapsulation of one protocol over another protocol. Other
|
||||
types of encapsulations [RFC 1241, SDRP, RFC 1479] have been proposed
|
||||
for transporting IP over IP for policy purposes. This memo describes
|
||||
a protocol which is very similar to, but is more general than, the
|
||||
above proposals. In attempting to be more general, many protocol
|
||||
specific nuances have been ignored. The result is that this proposal
|
||||
is may be less suitable for a situation where a specific "X over Y"
|
||||
encapsulation has been described. It is the attempt of this protocol
|
||||
to provide a simple, general purpose mechanism which is reduces the
|
||||
problem of encapsulation from its current O(n^2) problem to a more
|
||||
manageable state. This proposal also attempts to provide a
|
||||
lightweight encapsulation for use in policy based routing. This memo
|
||||
explicitly does not address the issue of when a packet should be
|
||||
encapsulated. This memo acknowledges, but does not address problems
|
||||
with mutual encapsulation [RFC 1326].
|
||||
|
||||
In the most general case, a system has a packet that needs to be
|
||||
encapsulated and routed. We will call this the payload packet. The
|
||||
payload is first encapsulated in a GRE packet, which possibly also
|
||||
includes a route. The resulting GRE packet can then be encapsulated
|
||||
in some other protocol and then forwarded. We will call this outer
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 1]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
protocol the delivery protocol. The algorithms for processing this
|
||||
packet are discussed later.
|
||||
|
||||
Overall packet
|
||||
|
||||
The entire encapsulated packet would then have the form:
|
||||
|
||||
---------------------------------
|
||||
| |
|
||||
| Delivery Header |
|
||||
| |
|
||||
---------------------------------
|
||||
| |
|
||||
| GRE Header |
|
||||
| |
|
||||
---------------------------------
|
||||
| |
|
||||
| Payload packet |
|
||||
| |
|
||||
---------------------------------
|
||||
|
||||
Packet header
|
||||
|
||||
The GRE packet header has the form:
|
||||
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|C|R|K|S|s|Recur| Flags | Ver | Protocol Type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Checksum (optional) | Offset (optional) |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Key (optional) |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Sequence Number (optional) |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Routing (optional)
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Flags and version (2 octets)
|
||||
|
||||
The GRE flags are encoded in the first two octets. Bit 0 is the
|
||||
most significant bit, bit 15 is the least significant bit. Bits
|
||||
13 through 15 are reserved for the Version field. Bits 5 through
|
||||
12 are reserved for future use and MUST be transmitted as zero.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 2]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
Checksum Present (bit 0)
|
||||
|
||||
If the Checksum Present bit is set to 1, then the Checksum field
|
||||
is present and contains valid information.
|
||||
|
||||
If either the Checksum Present bit or the Routing Present bit are
|
||||
set, BOTH the Checksum and Offset fields are present in the GRE
|
||||
packet.
|
||||
|
||||
Routing Present (bit 1)
|
||||
|
||||
If the Routing Present bit is set to 1, then it indicates that the
|
||||
Offset and Routing fields are present and contain valid
|
||||
information.
|
||||
|
||||
If either the Checksum Present bit or the Routing Present bit are
|
||||
set, BOTH the Checksum and Offset fields are present in the GRE
|
||||
packet.
|
||||
|
||||
Key Present (bit 2)
|
||||
|
||||
If the Key Present bit is set to 1, then it indicates that the Key
|
||||
field is present in the GRE header. Otherwise, the Key field is
|
||||
not present in the GRE header.
|
||||
|
||||
Sequence Number Present (bit 3)
|
||||
|
||||
If the Sequence Number Present bit is set to 1, then it indicates
|
||||
that the Sequence Number field is present. Otherwise, the
|
||||
Sequence Number field is not present in the GRE header.
|
||||
|
||||
Strict Source Route (bit 4)
|
||||
|
||||
The meaning of the Strict Source route bit is defined in other
|
||||
documents. It is recommended that this bit only be set to 1 if
|
||||
all of the the Routing Information consists of Strict Source
|
||||
Routes.
|
||||
|
||||
Recursion Control (bits 5-7)
|
||||
|
||||
Recursion control contains a three bit unsigned integer which
|
||||
contains the number of additional encapsulations which are
|
||||
permissible. This SHOULD default to zero.
|
||||
|
||||
Version Number (bits 13-15)
|
||||
|
||||
The Version Number field MUST contain the value 0. Other values
|
||||
are outside of the scope of this document.
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 3]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
Protocol Type (2 octets)
|
||||
|
||||
The Protocol Type field contains the protocol type of the payload
|
||||
packet. In general, the value will be the Ethernet protocol type
|
||||
field for the packet. Currently defined protocol types are listed
|
||||
below. Additional values may be defined in other documents.
|
||||
|
||||
Offset (2 octets)
|
||||
|
||||
The offset field indicates the octet offset from the start of the
|
||||
Routing field to the first octet of the active Source Route Entry
|
||||
to be examined. This field is present if the Routing Present or
|
||||
the Checksum Present bit is set to 1, and contains valid
|
||||
information only if the Routing Present bit is set to 1.
|
||||
|
||||
Checksum (2 octets)
|
||||
|
||||
The Checksum field contains the IP (one's complement) checksum of
|
||||
the GRE header and the payload packet. This field is present if
|
||||
the Routing Present or the Checksum Present bit is set to 1, and
|
||||
contains valid information only if the Checksum Present bit is set
|
||||
to 1.
|
||||
|
||||
Key (4 octets)
|
||||
|
||||
The Key field contains a four octet number which was inserted by
|
||||
the encapsulator. It may be used by the receiver to authenticate
|
||||
the source of the packet. The techniques for determining
|
||||
authenticity are outside of the scope of this document. The Key
|
||||
field is only present if the Key Present field is set to 1.
|
||||
|
||||
Sequence Number (4 octets)
|
||||
|
||||
The Sequence Number field contains an unsigned 32 bit integer
|
||||
which is inserted by the encapsulator. It may be used by the
|
||||
receiver to establish the order in which packets have been
|
||||
transmitted from the encapsulator to the receiver. The exact
|
||||
algorithms for the generation of the Sequence Number and the
|
||||
semantics of their reception is outside of the scope of this
|
||||
document.
|
||||
|
||||
Routing (variable)
|
||||
|
||||
The Routing field is optional and is present only if the Routing
|
||||
Present bit is set to 1.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 4]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
The Routing field is a list of Source Route Entries (SREs). Each
|
||||
SRE has the form:
|
||||
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Address Family | SRE Offset | SRE Length |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Routing Information ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
The routing field is terminated with a "NULL" SRE containing an
|
||||
address family of type 0x0000 and a length of 0.
|
||||
|
||||
Address Family (2 octets)
|
||||
|
||||
The Address Family field contains a two octet value which indicates
|
||||
the syntax and semantics of the Routing Information field. The
|
||||
values for this field and the corresponding syntax and semantics for
|
||||
Routing Information are defined in other documents.
|
||||
|
||||
SRE Offset (1 octet)
|
||||
|
||||
The SRE Offset field indicates the octet offset from the start of the
|
||||
Routing Information field to the first octet of the active entry in
|
||||
Source Route Entry to be examined.
|
||||
|
||||
SRE Length (1 octet)
|
||||
|
||||
The SRE Length field contains the number of octets in the SRE. If
|
||||
the SRE Length is 0, this indicates this is the last SRE in the
|
||||
Routing field.
|
||||
|
||||
Routing Information (variable)
|
||||
|
||||
The Routing Information field contains data which may be used in
|
||||
routing this packet. The exact semantics of this field is defined in
|
||||
other documents.
|
||||
|
||||
Forwarding of GRE packets
|
||||
|
||||
Normally, a system which is forwarding delivery layer packets will
|
||||
not differentiate GRE packets from other packets in any way.
|
||||
However, a GRE packet may be received by a system. In this case, the
|
||||
system should use some delivery-specific means to determine that this
|
||||
is a GRE packet. Once this is determined, the Key, Sequence Number
|
||||
and Checksum fields if they contain valid information as indicated by
|
||||
the corresponding flags may be checked. If the Routing Present bit
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 5]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
is set to 1, then the Address Family field should be checked to
|
||||
determine the semantics and use of the SRE Length, SRE Offset and
|
||||
Routing Information fields. The exact semantics for processing a SRE
|
||||
for each Address Family is defined in other documents.
|
||||
|
||||
Once all SREs have been processed, then the source route is complete,
|
||||
the GRE header should be removed, the payload's TTL MUST be
|
||||
decremented (if one exists) and the payload packet should be
|
||||
forwarded as a normal packet. The exact forwarding method depends on
|
||||
the Protocol Type field.
|
||||
|
||||
Current List of Protocol Types
|
||||
|
||||
The following are currently assigned protocol types for GRE. Future
|
||||
protocol types must be taken from DIX ethernet encoding. For
|
||||
historical reasons, a number of other values have been used for some
|
||||
protocols. The following table of values MUST be used to identify
|
||||
the following protocols:
|
||||
|
||||
Protocol Family PTYPE
|
||||
--------------- -----
|
||||
Reserved 0000
|
||||
SNA 0004
|
||||
OSI network layer 00FE
|
||||
PUP 0200
|
||||
XNS 0600
|
||||
IP 0800
|
||||
Chaos 0804
|
||||
RFC 826 ARP 0806
|
||||
Frame Relay ARP 0808
|
||||
VINES 0BAD
|
||||
VINES Echo 0BAE
|
||||
VINES Loopback 0BAF
|
||||
DECnet (Phase IV) 6003
|
||||
Transparent Ethernet Bridging 6558
|
||||
Raw Frame Relay 6559
|
||||
Apollo Domain 8019
|
||||
Ethertalk (Appletalk) 809B
|
||||
Novell IPX 8137
|
||||
RFC 1144 TCP/IP compression 876B
|
||||
IP Autonomous Systems 876C
|
||||
Secure Data 876D
|
||||
Reserved FFFF
|
||||
|
||||
See the IANA list of Ether Types for the complete list of these
|
||||
values.
|
||||
|
||||
URL = ftp://ftp.isi.edu/in-notes/iana/assignments/ethernet-numbers.
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 6]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
References
|
||||
|
||||
RFC 1479
|
||||
Steenstrup, M. "Inter-Domain Policy Routing Protocol
|
||||
Specification: Version 1", RFC1479, BBN Systems and Technologies,
|
||||
July 1993.
|
||||
|
||||
RFC 1226
|
||||
Kantor, B. "Internet Protocol Encapsulation of AX.25 Frames", RFC
|
||||
1226, University of California, San Diego, May 1991.
|
||||
|
||||
RFC 1234
|
||||
Provan, D. "Tunneling IPX Traffic through IP Networks", RFC 1234,
|
||||
Novell, Inc., June 1991.
|
||||
|
||||
RFC 1241
|
||||
Woodburn, R., and D. Mills, "Scheme for an Internet Encapsulation
|
||||
Protocol: Version 1", RFC 1241, SAIC, University of Delaware, July
|
||||
1991.
|
||||
|
||||
RFC 1326
|
||||
Tsuchiya, P., "Mutual Encapsulation Considered Dangerous", RFC
|
||||
1326, Bellcore, May 1992.
|
||||
|
||||
SDRP
|
||||
Estrin, D., Li, T., and Y. Rekhter, "Source Demand Routing
|
||||
Protocol Specification (Version 1)", Work in Progress.
|
||||
|
||||
RFC 1702
|
||||
Hanks, S., Li, T., Farinacci, D., and P. Traina, "Generic Routing
|
||||
Encapsulation over IPv4 networks", RFC 1702, NetSmiths, Ltd.,
|
||||
cisco Systems, October 1994.
|
||||
|
||||
Security Considerations
|
||||
|
||||
Security issues are not discussed in this memo.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 7]
|
||||
|
||||
RFC 1701 Generic Routing Encapsulation (GRE) October 1994
|
||||
|
||||
|
||||
Acknowledgements
|
||||
|
||||
The authors would like to acknowledge Yakov Rekhter (IBM) and Deborah
|
||||
Estrin (USC) for their advice, encouragement and insightful comments.
|
||||
|
||||
Authors' Addresses
|
||||
|
||||
Stan Hanks
|
||||
NetSmiths, Ltd.
|
||||
2025 Lincoln Highway
|
||||
Edison NJ, 08817
|
||||
|
||||
EMail: stan@netsmiths.com
|
||||
|
||||
|
||||
Tony Li
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: tli@cisco.com
|
||||
|
||||
|
||||
Dino Farinacci
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: dino@cisco.com
|
||||
|
||||
|
||||
Paul Traina
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: pst@cisco.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 8]
|
||||
|
|
@ -0,0 +1,227 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group S. Hanks
|
||||
Request for Comments: 1702 NetSmiths, Ltd.
|
||||
Category: Informational T. Li
|
||||
D. Farinacci
|
||||
P. Traina
|
||||
cisco Systems
|
||||
October 1994
|
||||
|
||||
|
||||
Generic Routing Encapsulation over IPv4 networks
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. This memo
|
||||
does not specify an Internet standard of any kind. Distribution of
|
||||
this memo is unlimited.
|
||||
|
||||
Introduction
|
||||
|
||||
In an earlier memo [RFC 1701], we described GRE, a mechanism for
|
||||
encapsulating arbitrary packets within an arbitrary transport
|
||||
protocol. This is a companion memo which describes the use of GRE
|
||||
with IP. This memo addresses the case of using IP as the delivery
|
||||
protocol or the payload protocol and the special case of IP as both
|
||||
the delivery and payload. This memo also describes using IP
|
||||
addresses and autonomous system numbers as part of a GRE source
|
||||
route.
|
||||
|
||||
IP as a delivery protocol
|
||||
|
||||
GRE packets which are encapsulated within IP will use IP protocol
|
||||
type 47.
|
||||
|
||||
IP as a payload protocol
|
||||
|
||||
IP packets will be encapsulated with a Protocol Type field of 0x800.
|
||||
|
||||
For the Address Family value of 0x800, the Routing Information field
|
||||
will consist of a list of IP addresses and indicates an IP source
|
||||
route. The first octet of the Routing Information field constitute a
|
||||
8 bit integer offset from the start of the Source Route Entry (SRE),
|
||||
called the SRE Offset. The SRE Offset indicates the first octet of
|
||||
the next IP address. The SRE Length field consists of the total
|
||||
length of the IP Address List in octets.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 1]
|
||||
|
||||
RFC 1702 GRE over IPv4 networks October 1994
|
||||
|
||||
|
||||
This has the form:
|
||||
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Address Family | SRE Offset | SRE Length |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address List ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
For the Address Family value of 0xfffe, the Routing Information field
|
||||
will consist of a list of Autonomous System numbers and indicates an
|
||||
AS source route. The third octet of the Routing Information field
|
||||
contains an 8 bit unsigned integer offset from the start of the
|
||||
Source Route Entry (SRE), called the SRE Offset. The SRE Offset
|
||||
indicates the first octet of the next AS number. THe SRE Length
|
||||
field consists of the total length of the AS Number list in octets.
|
||||
|
||||
0 1 2 3
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Address Family | SRE Offset | SRE Length |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| AS Number List ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
IP as both delivery and payload protocol
|
||||
|
||||
When IP is encapsulated in IP, the TTL, TOS, and IP security options
|
||||
MAY be copied from the payload packet into the same fields in the
|
||||
delivery packet. The payload packet's TTL MUST be decremented when
|
||||
the packet is decapsulated to insure that no packet lives forever.
|
||||
|
||||
IP source routes
|
||||
|
||||
When a system is processing a SRE with an Address Family indicating
|
||||
an IP source route, it MUST use the SRE Offset to determine the next
|
||||
destination IP address. If the next IP destination is this system,
|
||||
the SRE Offset field should be increased by four (the size of an IP
|
||||
address). If the SRE Offset is equal to the SRE Length in this SRE,
|
||||
then the Offset field in the GRE header should be adjusted to point
|
||||
to the next SRE (if any). This should be repeated until the next IP
|
||||
destination is not this system or until the entire SRE has been
|
||||
processed.
|
||||
|
||||
If the source route is incomplete, then the Strict Source Route bit
|
||||
is checked. If the source route is a strict source route and the
|
||||
next IP destination is NOT an adjacent system, the packet MUST be
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 2]
|
||||
|
||||
RFC 1702 GRE over IPv4 networks October 1994
|
||||
|
||||
|
||||
dropped. Otherwise, the system should use the IP address indicated
|
||||
by the Offset field to replace the destination address in the
|
||||
delivery header and forward the packet.
|
||||
|
||||
Autonomous system source routes
|
||||
|
||||
When a system is processing a SRE with an Address Family indicating
|
||||
an AS source route, it MUST use the SRE Offset field to determine the
|
||||
next autonomous system. If the next autonomous system is the local
|
||||
autonomous system, the SRE Offset field should be increased by two
|
||||
(the size of an autonomous system number). If the SRE Offset is
|
||||
equal to the SRE Length in this SRE, then the Offset field in the GRE
|
||||
header should be adjusted to point to the next SRE (if any). This
|
||||
should be repeated until the next autonomous system number is not
|
||||
equal to the local autonomous system number or until the entire SRE
|
||||
has been processed.
|
||||
|
||||
If the source route is incomplete, then the Strict Source Route bit
|
||||
is checked. If the source route is a strict source route and the
|
||||
next autonomous system is NOT an adjacent autonomous system, the
|
||||
packet should be dropped. Otherwise, the system should use the
|
||||
autonomous system number indicated by the SRE Offset field to replace
|
||||
the destination address in the delivery header and forward the
|
||||
packet. The exact mechanism for determining the next delivery
|
||||
destination address given the AS number is outside of the scope of
|
||||
this document.
|
||||
|
||||
Security Considerations
|
||||
|
||||
Security issues are not discussed in this memo.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 3]
|
||||
|
||||
RFC 1702 GRE over IPv4 networks October 1994
|
||||
|
||||
|
||||
Authors' Addresses
|
||||
|
||||
Stan Hanks
|
||||
NetSmiths, Ltd.
|
||||
2025 Lincoln Highway
|
||||
Edison, NJ 08817
|
||||
|
||||
EMail: stan@netsmiths.com
|
||||
|
||||
|
||||
Tony Li
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: tli@cisco.com
|
||||
|
||||
|
||||
Dino Farinacci
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: dino@cisco.com
|
||||
|
||||
|
||||
Paul Traina
|
||||
cisco Systems, Inc.
|
||||
1525 O'Brien Drive
|
||||
Menlo Park, CA 94025
|
||||
|
||||
EMail: pst@cisco.com
|
||||
|
||||
References
|
||||
|
||||
RFC 1701
|
||||
Hanks, S., Li, T, Farinacci, D., and P. Traina, "Generic Routing
|
||||
Encapsulation", RFC 1701, NetSmiths, Ltd., and cisco Systems,
|
||||
October 1994.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hanks, Li, Farinacci & Traina [Page 4]
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group S. Bradner
|
||||
Request for Comments: 2119 Harvard University
|
||||
BCP: 14 March 1997
|
||||
Category: Best Current Practice
|
||||
|
||||
|
||||
Key words for use in RFCs to Indicate Requirement Levels
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This document specifies an Internet Best Current Practices for the
|
||||
Internet Community, and requests discussion and suggestions for
|
||||
improvements. Distribution of this memo is unlimited.
|
||||
|
||||
Abstract
|
||||
|
||||
In many standards track documents several words are used to signify
|
||||
the requirements in the specification. These words are often
|
||||
capitalized. This document defines these words as they should be
|
||||
interpreted in IETF documents. Authors who follow these guidelines
|
||||
should incorporate this phrase near the beginning of their document:
|
||||
|
||||
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
|
||||
NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
|
||||
"OPTIONAL" in this document are to be interpreted as described in
|
||||
RFC 2119.
|
||||
|
||||
Note that the force of these words is modified by the requirement
|
||||
level of the document in which they are used.
|
||||
|
||||
1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that the
|
||||
definition is an absolute requirement of the specification.
|
||||
|
||||
2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that the
|
||||
definition is an absolute prohibition of the specification.
|
||||
|
||||
3. SHOULD This word, or the adjective "RECOMMENDED", mean that there
|
||||
may exist valid reasons in particular circumstances to ignore a
|
||||
particular item, but the full implications must be understood and
|
||||
carefully weighed before choosing a different course.
|
||||
|
||||
4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean that
|
||||
there may exist valid reasons in particular circumstances when the
|
||||
particular behavior is acceptable or even useful, but the full
|
||||
implications should be understood and the case carefully weighed
|
||||
before implementing any behavior described with this label.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Bradner Best Current Practice [Page 1]
|
||||
|
||||
RFC 2119 RFC Key Words March 1997
|
||||
|
||||
|
||||
5. MAY This word, or the adjective "OPTIONAL", mean that an item is
|
||||
truly optional. One vendor may choose to include the item because a
|
||||
particular marketplace requires it or because the vendor feels that
|
||||
it enhances the product while another vendor may omit the same item.
|
||||
An implementation which does not include a particular option MUST be
|
||||
prepared to interoperate with another implementation which does
|
||||
include the option, though perhaps with reduced functionality. In the
|
||||
same vein an implementation which does include a particular option
|
||||
MUST be prepared to interoperate with another implementation which
|
||||
does not include the option (except, of course, for the feature the
|
||||
option provides.)
|
||||
|
||||
6. Guidance in the use of these Imperatives
|
||||
|
||||
Imperatives of the type defined in this memo must be used with care
|
||||
and sparingly. In particular, they MUST only be used where it is
|
||||
actually required for interoperation or to limit behavior which has
|
||||
potential for causing harm (e.g., limiting retransmisssions) For
|
||||
example, they must not be used to try to impose a particular method
|
||||
on implementors where the method is not required for
|
||||
interoperability.
|
||||
|
||||
7. Security Considerations
|
||||
|
||||
These terms are frequently used to specify behavior with security
|
||||
implications. The effects on security of not implementing a MUST or
|
||||
SHOULD, or doing something the specification says MUST NOT or SHOULD
|
||||
NOT be done may be very subtle. Document authors should take the time
|
||||
to elaborate the security implications of not following
|
||||
recommendations or requirements as most implementors will not have
|
||||
had the benefit of the experience and discussion that produced the
|
||||
specification.
|
||||
|
||||
8. Acknowledgments
|
||||
|
||||
The definitions of these terms are an amalgam of definitions taken
|
||||
from a number of RFCs. In addition, suggestions have been
|
||||
incorporated from a number of people including Robert Ullmann, Thomas
|
||||
Narten, Neal McBurnett, and Robert Elz.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Bradner Best Current Practice [Page 2]
|
||||
|
||||
RFC 2119 RFC Key Words March 1997
|
||||
|
||||
|
||||
9. Author's Address
|
||||
|
||||
Scott Bradner
|
||||
Harvard University
|
||||
1350 Mass. Ave.
|
||||
Cambridge, MA 02138
|
||||
|
||||
phone - +1 617 495 3864
|
||||
|
||||
email - sob@harvard.edu
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Bradner Best Current Practice [Page 3]
|
||||
|
|
@ -0,0 +1,507 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group D. Farinacci
|
||||
Request for Comments: 2784 T. Li
|
||||
Category: Standards Track Procket Networks
|
||||
S. Hanks
|
||||
Enron Communications
|
||||
D. Meyer
|
||||
Cisco Systems
|
||||
P. Traina
|
||||
Juniper Networks
|
||||
March 2000
|
||||
|
||||
|
||||
Generic Routing Encapsulation (GRE)
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This document specifies an Internet standards track protocol for the
|
||||
Internet community, and requests discussion and suggestions for
|
||||
improvements. Please refer to the current edition of the "Internet
|
||||
Official Protocol Standards" (STD 1) for the standardization state
|
||||
and status of this protocol. Distribution of this memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2000). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
This document specifies a protocol for encapsulation of an arbitrary
|
||||
network layer protocol over another arbitrary network layer protocol.
|
||||
|
||||
1. Introduction
|
||||
|
||||
A number of different proposals [RFC1234, RFC1226] currently exist
|
||||
for the encapsulation of one protocol over another protocol. Other
|
||||
types of encapsulations [RFC1241, RFC1479] have been proposed for
|
||||
transporting IP over IP for policy purposes. This memo describes a
|
||||
protocol which is very similar to, but is more general than, the
|
||||
above proposals. In attempting to be more general, many protocol
|
||||
specific nuances have been ignored. The result is that this proposal
|
||||
may be less suitable for a situation where a specific "X over Y"
|
||||
encapsulation has been described. It is the attempt of this protocol
|
||||
to provide a simple, general purpose mechanism which reduces the
|
||||
problem of encapsulation from its current O(n^2) size to a more
|
||||
manageable size. This memo purposely does not address the issue of
|
||||
when a packet should be encapsulated. This memo acknowledges, but
|
||||
does not address problems such as mutual encapsulation [RFC1326].
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 1]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
In the most general case, a system has a packet that needs to be
|
||||
encapsulated and delivered to some destination. We will call this
|
||||
the payload packet. The payload is first encapsulated in a GRE
|
||||
packet. The resulting GRE packet can then be encapsulated in some
|
||||
other protocol and then forwarded. We will call this outer protocol
|
||||
the delivery protocol. The algorithms for processing this packet are
|
||||
discussed later.
|
||||
|
||||
Finally this specification describes the intersection of GRE
|
||||
currently deployed by multiple vendors.
|
||||
|
||||
The keywords MUST, MUST NOT, MAY, OPTIONAL, REQUIRED, RECOMMENDED,
|
||||
SHALL, SHALL NOT, SHOULD, SHOULD NOT are to be interpreted as defined
|
||||
in RFC 2119 [RFC2119].
|
||||
|
||||
2. Structure of a GRE Encapsulated Packet
|
||||
|
||||
A GRE encapsulated packet has the form:
|
||||
|
||||
---------------------------------
|
||||
| |
|
||||
| Delivery Header |
|
||||
| |
|
||||
---------------------------------
|
||||
| |
|
||||
| GRE Header |
|
||||
| |
|
||||
---------------------------------
|
||||
| |
|
||||
| Payload packet |
|
||||
| |
|
||||
---------------------------------
|
||||
|
||||
This specification is generally concerned with the structure of the
|
||||
GRE header, although special consideration is given to some of the
|
||||
issues surrounding IPv4 payloads.
|
||||
|
||||
2.1. GRE Header
|
||||
|
||||
The GRE packet header has the form:
|
||||
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|C| Reserved0 | Ver | Protocol Type |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Checksum (optional) | Reserved1 (Optional) |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 2]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
2.2. Checksum Present (bit 0)
|
||||
|
||||
If the Checksum Present bit is set to one, then the Checksum and the
|
||||
Reserved1 fields are present and the Checksum field contains valid
|
||||
information. Note that a compliant implementation MUST accept and
|
||||
process this field.
|
||||
|
||||
2.3. Reserved0 (bits 1-12)
|
||||
|
||||
A receiver MUST discard a packet where any of bits 1-5 are non-zero,
|
||||
unless that receiver implements RFC 1701. Bits 6-12 are reserved for
|
||||
future use. These bits MUST be sent as zero and MUST be ignored on
|
||||
receipt.
|
||||
|
||||
2.3.1. Version Number (bits 13-15)
|
||||
|
||||
The Version Number field MUST contain the value zero.
|
||||
|
||||
2.4. Protocol Type (2 octets)
|
||||
|
||||
The Protocol Type field contains the protocol type of the payload
|
||||
packet. These Protocol Types are defined in [RFC1700] as "ETHER
|
||||
TYPES" and in [ETYPES]. An implementation receiving a packet
|
||||
containing a Protocol Type which is not listed in [RFC1700] or
|
||||
[ETYPES] SHOULD discard the packet.
|
||||
|
||||
2.5. Checksum (2 octets)
|
||||
|
||||
The Checksum field contains the IP (one's complement) checksum sum of
|
||||
the all the 16 bit words in the GRE header and the payload packet.
|
||||
For purposes of computing the checksum, the value of the checksum
|
||||
field is zero. This field is present only if the Checksum Present bit
|
||||
is set to one.
|
||||
|
||||
2.6. Reserved1 (2 octets)
|
||||
|
||||
The Reserved1 field is reserved for future use, and if present, MUST
|
||||
be transmitted as zero. The Reserved1 field is present only when the
|
||||
Checksum field is present (that is, Checksum Present bit is set to
|
||||
one).
|
||||
|
||||
3. IPv4 as a Payload
|
||||
|
||||
When IPv4 is being carried as the GRE payload, the Protocol Type
|
||||
field MUST be set to 0x800.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 3]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
3.1. Forwarding Decapsulated IPv4 Payload Packets
|
||||
|
||||
When a tunnel endpoint decapsulates a GRE packet which has an IPv4
|
||||
packet as the payload, the destination address in the IPv4 payload
|
||||
packet header MUST be used to forward the packet and the TTL of the
|
||||
payload packet MUST be decremented. Care should be taken when
|
||||
forwarding such a packet, since if the destination address of the
|
||||
payload packet is the encapsulator of the packet (i.e., the other end
|
||||
of the tunnel), looping can occur. In this case, the packet MUST be
|
||||
discarded.
|
||||
|
||||
4. IPv4 as a Delivery Protocol
|
||||
|
||||
The IPv4 protocol 47 [RFC1700] is used when GRE packets are
|
||||
enapsulated in IPv4. See [RFC1122] for requirements relating to the
|
||||
delivery of packets over IPv4 networks.
|
||||
|
||||
5. Interoperation with RFC 1701 Compliant Implementations
|
||||
|
||||
In RFC 1701, the field described here as Reserved0 contained a number
|
||||
of flag bits which this specification deprecates. In particular, the
|
||||
Routing Present, Key Present, Sequence Number Present, and Strict
|
||||
Source Route bits have been deprecated, along with the Recursion
|
||||
Control field. As a result, the GRE header will never contain the
|
||||
Key, Sequence Number or Routing fields specified in RFC 1701.
|
||||
|
||||
There are, however, existing implementations of RFC 1701. The
|
||||
following sections describe correct interoperation with such
|
||||
implementations.
|
||||
|
||||
5.1. RFC 1701 Compliant Receiver
|
||||
|
||||
An implementation complying to this specification will transmit the
|
||||
Reserved0 field set to zero. An RFC 1701 compliant receiver will
|
||||
interpret this as having the Routing Present, Key Present, Sequence
|
||||
Number Present, and Strict Source Route bits set to zero, and will
|
||||
not expect the RFC 1701 Key, Sequence Number or Routing fields to be
|
||||
present.
|
||||
|
||||
5.2. RFC 1701 Compliant Transmitter
|
||||
|
||||
An RFC 1701 transmitter may set any of the Routing Present, Key
|
||||
Present, Sequence Number Present, and Strict Source Route bits set to
|
||||
one, and thus may transmit the RFC 1701 Key, Sequence Number or
|
||||
Routing fields in the GRE header. As stated in Section 5.3, a packet
|
||||
with non-zero bits in any of bits 1-5 MUST be discarded unless the
|
||||
receiver implements RFC 1701.
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 4]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
6. Security Considerations
|
||||
|
||||
Security in a network using GRE should be relatively similar to
|
||||
security in a normal IPv4 network, as routing using GRE follows the
|
||||
same routing that IPv4 uses natively. Route filtering will remain
|
||||
unchanged. However packet filtering requires either that a firewall
|
||||
look inside the GRE packet or that the filtering is done on the GRE
|
||||
tunnel endpoints. In those environments in which this is considered
|
||||
to be a security issue it may be desirable to terminate the tunnel at
|
||||
the firewall.
|
||||
|
||||
7. IANA Considerations
|
||||
|
||||
This section considers the assignment of additional GRE Version
|
||||
Numbers and Protocol Types.
|
||||
|
||||
7.1. GRE Version Numbers
|
||||
|
||||
This document specifies GRE version number 0. GRE version number 1 is
|
||||
used by PPTP [RFC2637]. Additional GRE version numbers are assigned
|
||||
by IETF Consensus as defined in RFC 2434 [RFC2434].
|
||||
|
||||
7.2. Protocol Types
|
||||
|
||||
GRE uses an ETHER Type for the Protocol Type. New ETHER TYPES are
|
||||
assigned by Xerox Systems Institute [RFC1700].
|
||||
|
||||
8. Acknowledgments
|
||||
|
||||
This document is derived from the original ideas of the authors of
|
||||
RFC 1701 and RFC 1702. Hitoshi Asaeda, Scott Bradner, Randy Bush,
|
||||
Brian Carpenter, Bill Fenner, Andy Malis, Thomas Narten, Dave Thaler,
|
||||
Tim Gleeson and others provided many constructive and insightful
|
||||
comments.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 5]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
9. Appendix -- Known Issues
|
||||
|
||||
This document specifies the behavior of currently deployed GRE
|
||||
implementations. As such, it does not attempt to address the
|
||||
following known issues:
|
||||
|
||||
o Interaction Path MTU Discovery (PMTU) [RFC1191]
|
||||
|
||||
Existing implementations of GRE, when using IPv4 as the Delivery
|
||||
Header, do not implement Path MTU discovery and do not set the
|
||||
Don't Fragment bit in the Delivery Header. This can cause large
|
||||
packets to become fragmented within the tunnel and reassembled at
|
||||
the tunnel exit (independent of whether the payload packet is using
|
||||
PMTU). If a tunnel entry point were to use Path MTU discovery,
|
||||
however, that tunnel entry point would also need to relay ICMP
|
||||
unreachable error messages (in particular the "fragmentation needed
|
||||
and DF set" code) back to the originator of the packet, which is
|
||||
not a requirement in this specification. Failure to properly relay
|
||||
Path MTU information to an originator can result in the following
|
||||
behavior: the originator sets the don't fragment bit, the packet
|
||||
gets dropped within the tunnel, but since the originator doesn't
|
||||
receive proper feedback, it retransmits with the same PMTU, causing
|
||||
subsequently transmitted packets to be dropped.
|
||||
|
||||
o IPv6 as Delivery and/or Payload Protocol
|
||||
|
||||
This specification describes the intersection of GRE currently
|
||||
deployed by multiple vendors. IPv6 as delivery and/or payload
|
||||
protocol is not included in the currently deployed versions of GRE.
|
||||
|
||||
o Interaction with ICMP
|
||||
|
||||
o Interaction with the Differentiated Services Architecture
|
||||
|
||||
o Multiple and Looping Encapsulations
|
||||
|
||||
10. REFERENCES
|
||||
|
||||
[ETYPES] ftp://ftp.isi.edu/in-notes/iana/assignments/ethernet-
|
||||
numbers
|
||||
|
||||
[RFC1122] Braden, R., "Requirements for Internet hosts -
|
||||
communication layers", STD 3, RFC 1122, October 1989.
|
||||
|
||||
[RFC1191] Mogul, J. and S. Deering, "Path MTU Discovery", RFC 1191,
|
||||
November 1990.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 6]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
[RFC1226] Kantor, B., "Internet Protocol Encapsulation of AX.25
|
||||
Frames", RFC 1226, May 1991.
|
||||
|
||||
[RFC1234] Provan, D., "Tunneling IPX Traffic through IP Networks",
|
||||
RFC 1234, June 1991.
|
||||
|
||||
[RFC1241] Woodburn, R. and D. Mills, "Scheme for an Internet
|
||||
Encapsulation Protocol: Version 1", RFC 1241, July 1991.
|
||||
|
||||
[RFC1326] Tsuchiya, P., "Mutual Encapsulation Considered Dangerous",
|
||||
RFC 1326, May 1992.
|
||||
|
||||
[RFC1479] Steenstrup, M., "Inter-Domain Policy Routing Protocol
|
||||
Specification: Version 1", RFC 1479, July 1993.
|
||||
|
||||
[RFC1700] Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, RFC
|
||||
1700, October 1994.
|
||||
|
||||
[RFC1701] Hanks, S., Li, T., Farinacci, D. and P. Traina, "Generic
|
||||
Routing Encapsulation", RFC 1701, October 1994.
|
||||
|
||||
[RFC1702] Hanks, S., Li, T., Farinacci, D. and P. Traina, "Generic
|
||||
Routing Encapsulation over IPv4 networks", RFC 1702,
|
||||
October 1994.
|
||||
|
||||
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
|
||||
Requirement Levels", BCP 14, RFC 2119, March, 1997.
|
||||
|
||||
[RFC2408] Maughan, D., Schertler, M., Schneider, M. and J. Turner,
|
||||
"Internet Security Association and Key Management Protocol
|
||||
(ISAKMP)", RFC 2408, November 1998.
|
||||
|
||||
[RFC2434] Narten, T. and H. Alvestrand, "Guidelines for Writing an
|
||||
IANA Considerations Section in RFCs", BCP 26, RFC 2434,
|
||||
October, 1998.
|
||||
|
||||
[RFC2637] Hamzeh, K., et al., "Point-to-Point Tunneling Protocol
|
||||
(PPTP)", RFC 2637, July, 1999.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 7]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
11. Authors' Addresses
|
||||
|
||||
Dino Farinacci
|
||||
Procket Networks
|
||||
3850 No. First St., Ste. C
|
||||
San Jose, CA 95134
|
||||
|
||||
EMail: dino@procket.com
|
||||
|
||||
|
||||
Tony Li
|
||||
Procket Networks
|
||||
3850 No. First St., Ste. C
|
||||
San Jose, CA 95134
|
||||
|
||||
Phone: +1 408 954 7903
|
||||
Fax: +1 408 987 6166
|
||||
EMail: tony1@home.net
|
||||
|
||||
|
||||
Stan Hanks
|
||||
Enron Communications
|
||||
|
||||
EMail: stan_hanks@enron.net
|
||||
|
||||
|
||||
David Meyer
|
||||
Cisco Systems, Inc.
|
||||
170 Tasman Drive
|
||||
San Jose, CA, 95134
|
||||
|
||||
EMail: dmm@cisco.com
|
||||
|
||||
|
||||
Paul Traina
|
||||
Juniper Networks
|
||||
EMail: pst@juniper.net
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 8]
|
||||
|
||||
RFC 2784 Generic Routing Encapsulation March 2000
|
||||
|
||||
|
||||
12. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2000). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Farinacci, et al. Standards Track [Page 9]
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,507 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Network Working Group D. Thaler
|
||||
Request for Comments: 2991 Microsoft
|
||||
Category: Informational C. Hopps
|
||||
NextHop Technologies
|
||||
November 2000
|
||||
|
||||
|
||||
Multipath Issues in Unicast and Multicast Next-Hop Selection
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This memo provides information for the Internet community. It does
|
||||
not specify an Internet standard of any kind. Distribution of this
|
||||
memo is unlimited.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (C) The Internet Society (2000). All Rights Reserved.
|
||||
|
||||
Abstract
|
||||
|
||||
Various routing protocols, including Open Shortest Path First (OSPF)
|
||||
and Intermediate System to Intermediate System (ISIS), explicitly
|
||||
allow "Equal-Cost Multipath" (ECMP) routing. Some router
|
||||
implementations also allow equal-cost multipath usage with RIP and
|
||||
other routing protocols. The effect of multipath routing on a
|
||||
forwarder is that the forwarder potentially has several next-hops for
|
||||
any given destination and must use some method to choose which next-
|
||||
hop should be used for a given data packet.
|
||||
|
||||
1. Introduction
|
||||
|
||||
Various routing protocols, including OSPF and ISIS, explicitly allow
|
||||
"Equal-Cost Multipath" routing. Some router implementations also
|
||||
allow equal-cost multipath usage with RIP and other routing
|
||||
protocols. Using equal-cost multipath means that if multiple equal-
|
||||
cost routes to the same destination exist, they can be discovered and
|
||||
used to provide load balancing among redundant paths.
|
||||
|
||||
The effect of multipath routing on a forwarder is that the forwarder
|
||||
potentially has several next-hops for any given destination and must
|
||||
use some method to choose which next-hop should be used for a given
|
||||
data packet. This memo summarizes current practices, problems, and
|
||||
solutions.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 1]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
2. Concerns
|
||||
|
||||
Several router implementations allow multipath forwarding. This is
|
||||
sometimes done naively via round-robin, where each packet matching a
|
||||
given destination route is forwarded using the subsequent next-hop,
|
||||
in a round-robin fashion. This does provide a form of load
|
||||
balancing, but there are several problems with approaches such as
|
||||
round-robin or random:
|
||||
|
||||
Variable Path MTU
|
||||
Since each of the redundant paths may have a different MTU,
|
||||
this means that the overall path MTU can change on a packet-
|
||||
by-packet basis, negating the usefulness of path MTU discovery.
|
||||
|
||||
Variable Latencies
|
||||
Since each of the redundant paths may have a different latency
|
||||
involved, having packets take separate paths can cause packets
|
||||
to always arrive out of order, increasing delivery latency and
|
||||
buffering requirements.
|
||||
|
||||
Packet reordering causes TCP to believe that loss has taken
|
||||
place when packets with higher sequence numbers arrive before
|
||||
an earlier one. When three or more packets are received before
|
||||
a "late" packet, TCP enters a mode called "fast-retransmit" [6]
|
||||
which consumes extra bandwidth (which could potentially cause
|
||||
more loss, decreasing throughput) as it attempts to
|
||||
unnecessarily retransmit the delayed packet(s). Hence,
|
||||
reordering can be detrimental to network performance.
|
||||
|
||||
Debugging
|
||||
Common debugging utilities such as ping and traceroute are much
|
||||
less reliable in the presence of multiple paths and may even
|
||||
present completely wrong results.
|
||||
|
||||
In multicast routing, the problem with multiple paths is that
|
||||
multicast routing protocols prevent loops and duplicates by
|
||||
constructing a single tree to all receivers of the same group
|
||||
address. Multicast routing protocols deployed today (DVMRP, PIM-DM,
|
||||
PIM-SM) [2] construct shortest-path trees rooted at either the
|
||||
source, or another router known as a Core or Rendezvous Point.
|
||||
Hence, the way they ensure that duplicates will not arise is that a
|
||||
given tree must use only a single next-hop towards the root of the
|
||||
tree.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 2]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
3. Requirements
|
||||
|
||||
In the remainder of this document, we will use the term "flow" to
|
||||
represent the granularity at which the router keeps state (if at all)
|
||||
for classes of traffic. The exact definition of a flow may depend on
|
||||
the actual implementation. For example, a flow might be identified
|
||||
solely by destination address, or it might be identified by (source
|
||||
address, destination address, protocol id) triplet. Hence "flow" is
|
||||
not necessarily synonymous with the term "microflow" as used in RFC
|
||||
2474 [7], which also includes port numbers. Indeed, including
|
||||
transport-layer information in the next-hop selection process can
|
||||
actually be problematic. For example, if packets are fragmented, the
|
||||
transport-layer information may not be available in every packet.
|
||||
Furthermore, having the choice of path depend on transport-layer
|
||||
fields may negate the benefit of caching information such as MTU for
|
||||
use in subsequent connections between the same endpoints.
|
||||
|
||||
All of the problems outlined in the previous section arise when
|
||||
packets in the same unicast or multicast "flow" are split among
|
||||
multiple paths. The natural solution is therefore to ensure that
|
||||
packets for the same flow always use the same path.
|
||||
|
||||
Two additional features are desirable:
|
||||
|
||||
Minimal disruption
|
||||
When multipath is used, meaning that multiple routes contribute
|
||||
valid next-hops, the chances are higher of routes being added
|
||||
and deleted from consideration than when only the "best" route
|
||||
is used (in which case metric changes in alternate routes have
|
||||
no effect on traffic paths). Since a higher number of routes
|
||||
may actually be used for forwarding when multipath is in use,
|
||||
the potential for packet reordering and packet loss due to
|
||||
route flaps can be much greater than when not using multipath.
|
||||
Hence, it is desirable to minimize the number of active flows
|
||||
affected by the addition or deletion of another next-hop.
|
||||
|
||||
Fast implementation
|
||||
The amount of additional computation required to forward a
|
||||
packet should be small. For example, when doing round-robin,
|
||||
this computation might consist of incrementing (modulo the
|
||||
number of next-hops) a next-hop index.
|
||||
|
||||
4. Solutions
|
||||
|
||||
We now provide three possible methods for improving the performance
|
||||
of multipath and then discuss their applicability to unicast and
|
||||
multicast forwarding.
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 3]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
Modulo-N Hash
|
||||
To select a next-hop from the list of N next-hops, the router
|
||||
performs a modulo-N hash over the packet header fields that
|
||||
identify a flow. This has the advantage of being fast, at the
|
||||
expense of (N-1)/N of all flows changing paths whenever a
|
||||
next-hop is added or removed.
|
||||
|
||||
Hash-Threshold
|
||||
The router first selects a key by performing a hash over the
|
||||
packet header fields that identify the flow. The N next-hops
|
||||
have been assigned unique regions in the hash function's output
|
||||
space. By comparing the hash value against region boundaries
|
||||
the router can determine which region the hash value belongs to
|
||||
and thus which next-hop to use. This method has the advantage
|
||||
of only affecting flows near the region boundaries (or
|
||||
thresholds) when next-hops are added or removed. For ECMP
|
||||
hash-threshold's lookup can be done with a simple division
|
||||
(hash_value / fixed_region_size). When a next-hop is added or
|
||||
removed, between 1/4 and 1/2 of all flows change paths. An
|
||||
analysis of this method can be found in [3].
|
||||
|
||||
Highest Random Weight (HRW)
|
||||
The router computes a key for EACH next-hop by performing a
|
||||
hash over the packet header fields that identify the flow, as
|
||||
well as over the address of the next-hop. The router then
|
||||
chooses the next-hop with the highest resulting key value [4].
|
||||
This has the advantage of minimizing the number of flows
|
||||
affected by a next-hop addition or deletion (only 1/N of them),
|
||||
but is approximately N times as expensive as a modulo-N hash.
|
||||
|
||||
The applicability of these three alternatives depends on (at least)
|
||||
two factors: whether the forwarder maintains per-flow state, and how
|
||||
precious CPU is to a multipath forwarder.
|
||||
|
||||
Some routers may maintain per-flow state for reasons other than for
|
||||
supporting multipath. For example, routers typically keep per-flow
|
||||
state for multicast flows so that they can maintain the list of
|
||||
interfaces to which packets in the flow should be copied.
|
||||
|
||||
If per-flow state is maintained in a multipath forwarder, then
|
||||
computation of the next-hop can be done by the router at state
|
||||
creation time. This entails no additional computations at packet
|
||||
forwarding time compared with normal forwarding to a single next-hop,
|
||||
since the next-hop is precomputed. In this case, any method can be
|
||||
used, including round-robin, random, modulo-N, hash-threshold or HRW.
|
||||
Hash functions such as modulo-N, hash-threshold and HRW are better if
|
||||
the forwarder state may be deleted for any reason during the lifetime
|
||||
of a flow since subsequent next-hop computations by the router will
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 4]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
always select the same path. This also improves the usefulness of
|
||||
debugging utilities such as traceroute. Finally, to maximize the
|
||||
stability of paths (and hence the usefulness of traceroute, etc.),
|
||||
the use of HRW is recommended over the other methods mentioned
|
||||
herein.
|
||||
|
||||
If per-flow state is not maintained by the forwarder, then using
|
||||
multiple next-hops requires that the next-hop be calculated at packet
|
||||
arrival time. When CPU is more precious than stability of flow
|
||||
paths, hash-threshold is recommended over the other methods mentioned
|
||||
herein.
|
||||
|
||||
4.1. Unicast Forwarding
|
||||
|
||||
Depending on the implementation, unicast forwarding may or may not
|
||||
keep per-flow state. We recommend that where forwarder
|
||||
implementations keep flow state, routers should use HRW at state
|
||||
creation time (and next-hop deletion time) to select the next-hop,
|
||||
and that forwarders without per-flow state use hash-threshold.
|
||||
|
||||
4.2. Multicast Forwarding
|
||||
|
||||
Today's multicast forwarding engines use a cache of forwarding
|
||||
entries indexed by group (or group prefix) and source (or source
|
||||
prefix). This means that today's multicast forwarder's always keep
|
||||
per-flow state, although for some multicast routing protocols, the
|
||||
"flow" may be fairly coarse (e.g., traffic from all sources to the
|
||||
same destination). Since per-flow state is kept by the forwarder, it
|
||||
is recommended that the router always use HRW to select the next-hop.
|
||||
|
||||
Routers using explicit-joining protocols such as PIM-SM [5] should
|
||||
thus use the multipath information when determining to which neighbor
|
||||
a join message should be sent. For example, when multiple next-hops
|
||||
exist for a given Rendezvous Point (RP) toward which a (*,G) Join
|
||||
should be sent, it is recommended that HRW be used to select the
|
||||
next-hop to use for each group.
|
||||
|
||||
5. Applicability
|
||||
|
||||
The algorithms discussed above (except round-robin) all rely on some
|
||||
form of hash function. Equal flow distribution is achieved when the
|
||||
hash function is uniformly distributed. Since the commonly used hash
|
||||
functions only become uniformly distributed when the number of inputs
|
||||
is relatively large, these algorithms are more applicable to routers
|
||||
used to route many flows, than in, for example, a small business
|
||||
setting.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 5]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
6. Redundant Parallel Links
|
||||
|
||||
A related problem occurs when multiple parallel links are used
|
||||
between the same pair of routers. A common solution is to bundle the
|
||||
two links together into a "super"-link when is then used for routing.
|
||||
For multicast forwarding, this results in the two links being reduced
|
||||
to a single next-hop (over the combined link) which can be used to
|
||||
prevent duplicates. When a unicast or multicast packet is queued to
|
||||
the combined link, some method, such as those discussed earlier, is
|
||||
still required to determine the physical link on which to transmit
|
||||
the packet. If the parallel links are identical, then most of the
|
||||
concerns discussed in this document are avoided with the combined
|
||||
link. The exception is packet reordering, which can still occur with
|
||||
round-robin, adversely affecting TCP.
|
||||
|
||||
7. Security Considerations
|
||||
|
||||
This document discusses issues with various methods of choosing a
|
||||
next-hop from among multiple valid next-hops. As such, it does not
|
||||
directly impact the security of the Internet infrastructure or its
|
||||
applications.
|
||||
|
||||
One issue that is worth mentioning, however, is that when next-hop
|
||||
selection is predictable, an attacker can synthesize traffic that
|
||||
will all hash the same, making it possible to launch a denial-of-
|
||||
service attack that overloads a particular path. Since a special
|
||||
case of this is when the same (single) next-hop is always selected,
|
||||
such an attack is easiest when multipath is not being used.
|
||||
Introducing multipath routing can make such an attack more difficult;
|
||||
the more unpredictable the hash is, the harder it becomes to conduct
|
||||
a denial-of-service attack against any single link.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 6]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
8. References
|
||||
|
||||
[1] Moy, J., "OSPF Version 2", STD 54, RFC 2328, April 1998.
|
||||
|
||||
[2] Maufer, T., "Deploying IP Multicast in the Enterprise",
|
||||
Prentice-Hall, 1998.
|
||||
|
||||
[3] Hopps, C., "Analysis of an Equal-Cost Multi-Path Algorithm", RFC
|
||||
2992, November 2000.
|
||||
|
||||
[4] Thaler, D., and C.V. Ravishankar, "Using Name-Based Mappings to
|
||||
Increase Hit Rates", IEEE/ACM Transactions on Networking,
|
||||
February 1998.
|
||||
|
||||
[5] Estrin, D., Farinacci, D., Helmy, A., Thaler, D., Deering, S.,
|
||||
Handley, M., Jacobson, V., Liu, C., Sharma, P. and L. Wei,
|
||||
"Protocol Independent Multicast-Sparse Mode (PIM-SM): Protocol
|
||||
Specification", RFC 2362, June 1998.
|
||||
|
||||
[6] Allman, M., Paxson, V. and W. Stevens, "TCP Congestion Control",
|
||||
RFC 2581, April 1999.
|
||||
|
||||
[7] Nichols, K., Blake, S., Baker, F. and D. Black., "Definition of
|
||||
the Differentiated Services Field (DS Field) in the IPv4 and
|
||||
IPv6 Headers", RFC 2474, December 1998.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 7]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
9. Authors' Addresses
|
||||
|
||||
Dave Thaler
|
||||
Microsoft
|
||||
One Microsoft Way
|
||||
Redmond, WA 98052
|
||||
|
||||
Phone: +1 425 703 8835
|
||||
EMail: dthaler@dthaler.microsoft.com
|
||||
|
||||
|
||||
Christian E. Hopps
|
||||
NextHop Technologies, Inc.
|
||||
517 W. William Street
|
||||
Ann Arbor, MI 48103-4943
|
||||
U.S.A
|
||||
|
||||
Phone: +1 734 936 0291
|
||||
EMail: chopps@nexthop.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 8]
|
||||
|
||||
RFC 2991 Multipath Issues November 2000
|
||||
|
||||
|
||||
10. Full Copyright Statement
|
||||
|
||||
Copyright (C) The Internet Society (2000). All Rights Reserved.
|
||||
|
||||
This document and translations of it may be copied and furnished to
|
||||
others, and derivative works that comment on or otherwise explain it
|
||||
or assist in its implementation may be prepared, copied, published
|
||||
and distributed, in whole or in part, without restriction of any
|
||||
kind, provided that the above copyright notice and this paragraph are
|
||||
included on all such copies and derivative works. However, this
|
||||
document itself may not be modified in any way, such as by removing
|
||||
the copyright notice or references to the Internet Society or other
|
||||
Internet organizations, except as needed for the purpose of
|
||||
developing Internet standards in which case the procedures for
|
||||
copyrights defined in the Internet Standards process must be
|
||||
followed, or as required to translate it into languages other than
|
||||
English.
|
||||
|
||||
The limited permissions granted above are perpetual and will not be
|
||||
revoked by the Internet Society or its successors or assigns.
|
||||
|
||||
This document and the information contained herein is provided on an
|
||||
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
|
||||
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
|
||||
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Acknowledgement
|
||||
|
||||
Funding for the RFC Editor function is currently provided by the
|
||||
Internet Society.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Thaler & Hopps Informational [Page 9]
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,731 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Internet Engineering Task Force (IETF) B. Carpenter
|
||||
Request for Comments: 7098 Univ. of Auckland
|
||||
Category: Informational S. Jiang
|
||||
ISSN: 2070-1721 Huawei Technologies Co., Ltd
|
||||
W. Tarreau
|
||||
HAProxy Technologies, Inc.
|
||||
January 2014
|
||||
|
||||
|
||||
Using the IPv6 Flow Label for Load Balancing in Server Farms
|
||||
|
||||
Abstract
|
||||
|
||||
This document describes how the currently specified IPv6 flow label
|
||||
can be used to enhance layer 3/4 (L3/4) load distribution and
|
||||
balancing for large server farms.
|
||||
|
||||
Status of This Memo
|
||||
|
||||
This document is not an Internet Standards Track specification; it is
|
||||
published for informational purposes.
|
||||
|
||||
This document is a product of the Internet Engineering Task Force
|
||||
(IETF). It represents the consensus of the IETF community. It has
|
||||
received public review and has been approved for publication by the
|
||||
Internet Engineering Steering Group (IESG). Not all documents
|
||||
approved by the IESG are a candidate for any level of Internet
|
||||
Standard; see Section 2 of RFC 5741.
|
||||
|
||||
Information about the current status of this document, any errata,
|
||||
and how to provide feedback on it may be obtained at
|
||||
http://www.rfc-editor.org/info/rfc7098.
|
||||
|
||||
Copyright Notice
|
||||
|
||||
Copyright (c) 2014 IETF Trust and the persons identified as the
|
||||
document authors. All rights reserved.
|
||||
|
||||
This document is subject to BCP 78 and the IETF Trust's Legal
|
||||
Provisions Relating to IETF Documents
|
||||
(http://trustee.ietf.org/license-info) in effect on the date of
|
||||
publication of this document. Please review these documents
|
||||
carefully, as they describe your rights and restrictions with respect
|
||||
to this document. Code Components extracted from this document must
|
||||
include Simplified BSD License text as described in Section 4.e of
|
||||
the Trust Legal Provisions and are provided without warranty as
|
||||
described in the Simplified BSD License.
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 1]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
Table of Contents
|
||||
|
||||
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
|
||||
2. Summary of Flow Label Specification . . . . . . . . . . . . . 2
|
||||
3. Summary of Server Farm Load-Balancing Techniques . . . . . . 4
|
||||
4. Applying the Flow Label to Layer 3/4 Load Balancing . . . . . 8
|
||||
5. Security Considerations . . . . . . . . . . . . . . . . . . . 10
|
||||
6. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 11
|
||||
7. References . . . . . . . . . . . . . . . . . . . . . . . . . 12
|
||||
7.1. Normative References . . . . . . . . . . . . . . . . . . 12
|
||||
7.2. Informative References . . . . . . . . . . . . . . . . . 12
|
||||
|
||||
1. Introduction
|
||||
|
||||
The IPv6 flow label has been redefined [RFC6437] and is now a
|
||||
recommended IPv6 node requirement [RFC6434]. Its use for load
|
||||
sharing in multipath routing has been specified [RFC6438]. Another
|
||||
scenario in which the flow label could be used is in load
|
||||
distribution for large server farms. Load distribution is a slightly
|
||||
more general term than load balancing, but the latter is more
|
||||
commonly used. In the context of a server farm, both terms refer to
|
||||
mechanisms that distribute the workload of a server farm among
|
||||
different servers in order to optimize performance. Server load
|
||||
balancing commonly applies to HTTP traffic, but most of the
|
||||
techniques described would apply to other upper-layer applications as
|
||||
well. This document starts with brief introductions to the flow
|
||||
label and to server load-balancing techniques, and then describes how
|
||||
the flow label can be used to enhance load balancers operating on IP
|
||||
packets and TCP sessions, commonly known as layer 3/4 load balancers.
|
||||
|
||||
The motivation for this approach is to improve the performance of
|
||||
most types of layer 3/4 load balancers, especially for traffic
|
||||
including multiple IPv6 extension headers and in particular for
|
||||
fragmented packets. Fragmented packets, often the result of
|
||||
customers reaching the load balancer via a VPN with a limited MTU,
|
||||
are a common performance problem.
|
||||
|
||||
2. Summary of Flow Label Specification
|
||||
|
||||
The IPv6 flow label [RFC6437] is a 20-bit field included in every
|
||||
IPv6 header [RFC2460]. It is recommended to be supported in all IPv6
|
||||
nodes by [RFC6434]. There is additional background material in
|
||||
[RFC6436] and [RFC6294]. According to its definition, the flow label
|
||||
should be set to a constant value for a given traffic flow (such as
|
||||
an HTTP connection), and that value will belong to a uniform
|
||||
statistical distribution, making it potentially valuable for load-
|
||||
balancing purposes.
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 2]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
Any device that has access to the IPv6 header has access to the flow
|
||||
label, and it is at a fixed position in every IPv6 packet. In
|
||||
contrast, transport-layer information, such as the port numbers, is
|
||||
not always in a fixed position, since it follows any IPv6 extension
|
||||
headers that may be present. In fact, the logic of finding the
|
||||
transport header is always more complex for IPv6 than for IPv4, due
|
||||
to the absence of an Internet Header Length field in IPv6.
|
||||
Additionally, if packets are fragmented, the flow label will be
|
||||
present in all fragments, but the transport header will only be in
|
||||
one packet. Therefore, within the lifetime of a given transport-
|
||||
layer connection, the flow label can be a more convenient "handle"
|
||||
than the port number for identifying that particular connection.
|
||||
|
||||
According to RFC 6437, source hosts should set the flow label;
|
||||
however, if they do not (i.e., its value is zero), forwarding nodes
|
||||
(such as the first-hop router) may set it instead. In both cases,
|
||||
the flow label value must be constant for a given transport session,
|
||||
normally identified by the IPv6 and Transport header 5-tuple. By
|
||||
default, the flow label value should be calculated by a stateless
|
||||
algorithm. The resulting value should form part of a statistically
|
||||
uniform distribution, regardless of which node sets it.
|
||||
|
||||
It is recognized that at the time of writing, very few traffic flows
|
||||
include a non-zero flow label value. The mechanism described below
|
||||
is one that can be added to existing load-balancing mechanisms, so
|
||||
that it will become effective as more and more flows contain a non-
|
||||
zero label. Even if the flow label is chosen from an imperfectly
|
||||
uniform distribution, it will nevertheless increase the information
|
||||
entropy of the IPv6 header as a whole. This allows for progressive
|
||||
introduction of load balancing based on the flow label.
|
||||
|
||||
If the recommendations in Section 3 of RFC 6437 are followed for
|
||||
traffic from a given source accessing a well-known TCP port at a
|
||||
given destination, the flow label can act as a substitute for the
|
||||
port numbers as far as a load balancer is concerned, and it can be
|
||||
found at a fixed position in the layer 3 header even if extension
|
||||
headers are present.
|
||||
|
||||
The flow label is defined as an end-to-end component of the IPv6
|
||||
header, but there are three qualifications to this:
|
||||
|
||||
1. Until the IPv6 flow label specification in RFC 6437 is widely
|
||||
implemented as recommended by RFC 6434, the flow label will often
|
||||
be set to the default value of zero.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 3]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
2. Because of the recommendation to use a stateless algorithm to
|
||||
calculate the label, there is a low (but non-zero) probability
|
||||
that two simultaneous flows from the same source to the same
|
||||
destination have the same flow label value despite having
|
||||
different transport-protocol port numbers.
|
||||
|
||||
3. The Flow Label field is in an unprotected part of the IPv6
|
||||
header, which means that intentional or unintentional changes to
|
||||
its value cannot be easily detected by a receiver.
|
||||
|
||||
The first two points are addressed below in Section 4 and the third
|
||||
in Section 5.
|
||||
|
||||
3. Summary of Server Farm Load-Balancing Techniques
|
||||
|
||||
Load balancing for server farms is achieved by a variety of methods,
|
||||
often used in combination [Tarreau]. This section gives a general
|
||||
overview of common methods, although the flow label is not relevant
|
||||
to all of them. The actual load-balancing algorithm (the choice of
|
||||
which server to use for a new client session) is irrelevant to this
|
||||
discussion. We give examples for HTTP, but analogous techniques may
|
||||
be used for other application protocols.
|
||||
|
||||
o The simplest method is using the DNS to return different server
|
||||
addresses for a single name such as www.example.com to different
|
||||
users. This is typically done by rotating the order in which
|
||||
different addresses within the server site are listed by the
|
||||
relevant authoritative DNS server, on the assumption that the
|
||||
client will pick the first one. Routing may be configured such
|
||||
that the different addresses are handled by different ingress
|
||||
routers. Several variants of this load-balancing mechanism exist,
|
||||
such as expecting some clients to use all the advertised addresses
|
||||
when multiple connections are involved, or directing the traffic
|
||||
to multiple sites, also known as global load balancing. None of
|
||||
these mechanisms are in the scope of this document, and the
|
||||
proposal in this document does not affect their usability nor aim
|
||||
to replace them, so they will not be discussed further.
|
||||
|
||||
o Another method, for HTTP servers, is to operate a layer 7 reverse
|
||||
proxy in front of the server farm. The reverse proxy will present
|
||||
a single IP address to the world, communicated to clients by a
|
||||
single AAAA record. For each new client session (an incoming TCP
|
||||
connection and HTTP request), it will pick a particular server and
|
||||
proxy the session to it. The act of proxying should be more
|
||||
efficient and less resource-intensive than the act of serving the
|
||||
required content. The proxy must retain TCP state and proxy state
|
||||
for the duration of the session. This TCP state could,
|
||||
potentially, include the incoming flow label value.
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 4]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
o A component of some load-balancing systems is an SSL reverse proxy
|
||||
farm. The individual SSL proxies handle all cryptographic aspects
|
||||
and exchange unencrypted HTTP with the actual servers. Thus, from
|
||||
the load-balancing point of view, this really looks just like a
|
||||
server farm, except that it's specialized for HTTPS. Each proxy
|
||||
will retain SSL and TCP and maybe HTTP state for the duration of
|
||||
the session, and the TCP state could potentially include the flow
|
||||
label.
|
||||
|
||||
o Finally the "front end" of many load-balancing systems is a layer
|
||||
3/4 load balancer. While it can be a dedicated device, it is also
|
||||
a standard function of some network switches or routers (e.g.
|
||||
using Equal-Cost Multipath Routing (ECMP) [RFC2991]). In this
|
||||
case, it is the layer 3/4 load balancer whose IP address is
|
||||
published as the primary AAAA record for the service. All client
|
||||
sessions will pass through this device. Depending on the specific
|
||||
scenario, the balancer will assign new sessions among the actual
|
||||
application servers, across an SSL proxy farm, or among a set of
|
||||
layer 7 proxies. In all cases, the layer 3/4 load balancer has to
|
||||
classify incoming packets very quickly and choose the target
|
||||
server or proxy so as to ensure persistence. 'Persistence' is
|
||||
defined as the guarantee that a given client session will run to
|
||||
completion on a single server. The layer 3/4 load balancer
|
||||
therefore needs to inspect each incoming packet to classify it.
|
||||
There are two common types of layer 3/4 load balancers, the
|
||||
totally stateless ones which only act on single packets, generally
|
||||
involving a per-packet hashing of easy-to-find information such as
|
||||
the source address and/or port into a server number, and the
|
||||
stateful ones that take the routing decision on the very first
|
||||
packets of a session and maintain the same direction for all
|
||||
packets belonging to the same session. Clearly, both types of
|
||||
layer 3/4 balancers could inspect and make use of the flow label
|
||||
value.
|
||||
|
||||
Our focus is on how the balancer identifies a particular flow.
|
||||
For clarity, note that two aspects of layer 3/4 load balancers are
|
||||
not affected by use of the flow label to identify sessions:
|
||||
|
||||
1. Balancers use various techniques to redirect traffic to a
|
||||
specific target server.
|
||||
|
||||
+ All servers are configured with the same IP address, they
|
||||
are all on the same LAN, and the load balancer sends
|
||||
directly to their individual MAC addresses. In this case,
|
||||
return packets from the server to the client are sent back
|
||||
without passing through the balancer, a technique known as
|
||||
direct server return, but we are not concerned here with
|
||||
the return packets.
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 5]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
+ All servers are configured with the same IP address,
|
||||
treated locally as an anycast address by layer 3 ECMP
|
||||
routing.
|
||||
|
||||
+ Each server has its own IP address, and the balancer uses
|
||||
an IP-in-IP tunnel to reach it.
|
||||
|
||||
+ Each server has its own IP address, and the balancer
|
||||
performs NAPT (Network Address and Port Translation) to
|
||||
deliver the client's packets to that address.
|
||||
|
||||
+ The choice between these methods is not affected by use of
|
||||
the flow label.
|
||||
|
||||
2. A layer 3/4 balancer must correctly handle Path MTU Discovery
|
||||
by forwarding relevant ICMPv6 packets in both directions.
|
||||
This too is not directly affected by use of the flow label.
|
||||
It should be noted that there may be difficulty correlating an
|
||||
ICMPv6 "Packet too big" response with the session it refers
|
||||
to, but that is out of the scope of the present document.
|
||||
|
||||
The following diagram, inspired by [Tarreau], shows a layout with
|
||||
various methods in use together. (Below, "ASIC" stands for
|
||||
"Application-Specific Integrated Circuit".)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 6]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
___________________________________________
|
||||
( )
|
||||
( Clients in the Internet )
|
||||
(___________________________________________)
|
||||
| |
|
||||
------------ DNS-based ------------
|
||||
| Ingress | load splitting | Ingress |
|
||||
| router | affects | router |
|
||||
------------ routing ------------
|
||||
___|____________________________|___
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
------------ ------------
|
||||
| L3/4 ASIC| | L3/4 ASIC|
|
||||
| balancer | | balancer |
|
||||
------------ ------------
|
||||
| load |
|
||||
| spreading |
|
||||
__________|________________________|___________
|
||||
| | | |
|
||||
------------ ------------ -------- --------
|
||||
|HTTP proxy|...|HTTP proxy| | SSL |...| SSL |
|
||||
| balancer | | balancer | | proxy| | proxy|
|
||||
------------ ------------ -------- --------
|
||||
____|_____________|_____________|_________|_____
|
||||
| | | | |
|
||||
-------- -------- -------- -------- --------
|
||||
|HTTP | |HTTP | |HTTP | |HTTP | |HTTP |
|
||||
|server| |server| |server| |server| |server|
|
||||
-------- -------- -------- -------- --------
|
||||
|
||||
From the previous paragraphs, we can identify several points in this
|
||||
diagram where the flow label might be relevant:
|
||||
|
||||
1. Layer 3/4 load balancers.
|
||||
|
||||
2. SSL proxies.
|
||||
|
||||
3. HTTP proxies.
|
||||
|
||||
However, usage by the proxies seems unlikely to affect performance,
|
||||
because they must in any case process the application-layer header,
|
||||
so in this document we focus only on layer 3/4 balancers.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 7]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
4. Applying the Flow Label to Layer 3/4 Load Balancing
|
||||
|
||||
The suggested model for using the flow label to enhance an layer 3/4
|
||||
load-balancing mechanism is as follows:
|
||||
|
||||
o We are only concerned with IPv6 traffic in which the flow label
|
||||
value has been set according to [RFC6437]. If the flow label of
|
||||
an incoming packet is zero, load balancers will continue to use
|
||||
the transport header in the traditional way. As the use of the
|
||||
flow label becomes more prevalent according to RFC 6434, load
|
||||
balancers, and therefore users, will reap a growing performance
|
||||
benefit.
|
||||
|
||||
o If the flow label of an incoming packet is non-zero, layer 3/4
|
||||
load balancers can use the 2-tuple {source address, flow label} as
|
||||
the session key for whatever load distribution algorithm they
|
||||
support. Alternatively, they might use the 3-tuple {dest address,
|
||||
source address, flow label}, especially if the server farm
|
||||
supports multiple server IP addresses, but using the 3-tuple will
|
||||
be significantly quicker than searching for the transport port
|
||||
numbers later in the packet. Moreover, the transport-layer
|
||||
information such as the source port is not repeated in fragments,
|
||||
which generally prevents stateless load balancers from supporting
|
||||
fragmented traffic since they generally cannot reassemble
|
||||
fragments.
|
||||
|
||||
A stateless layer 3/4 load balancer would simply apply a hash
|
||||
algorithm to the 2-tuple or 3-tuple on all packets in order to
|
||||
select the same target server consistently for a given flow.
|
||||
Needless to say, the hash algorithm has to be well chosen for its
|
||||
purpose, but this problem is common to several forms of stateless
|
||||
load balancing. The discussion in [RFC6438] applies.
|
||||
|
||||
A stateful layer 3/4 load balancer would apply its usual load
|
||||
distribution algorithm to the first packet of a session, and store
|
||||
the {tuple, server} association in a table so that subsequent
|
||||
packets belonging to the same session are forwarded to the same
|
||||
server. Thus, for all subsequent packets of the session, it can
|
||||
ignore all IPv6 extension headers, which should lead to a
|
||||
performance benefit. Whether this benefit is valuable will depend
|
||||
on engineering details of the specific load balancer.
|
||||
|
||||
Note that such a balancer will not identify new transport sessions
|
||||
from the same source that use the same flow label; they will be
|
||||
delivered to the same server. This is like the behavior of
|
||||
existing hash-based layer 4 balancers that always send similarly
|
||||
hashed packets to the same destination. However, a global state
|
||||
table in a flow label balancer cannot be shared between multiple
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 8]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
services if these services rely on transport-layer information,
|
||||
since the goal of using the flow label is to avoid looking up that
|
||||
information.
|
||||
|
||||
A related issue is that the balancer will not detect FIN/ACK
|
||||
sequences at the end of sessions. Therefore, it will rely on
|
||||
inactivity timers to delete session state. However, all existing
|
||||
balancers must maintain such timers to deal with hung sessions,
|
||||
and the practical impact on memory utilization is unlikely to be
|
||||
significant.
|
||||
|
||||
o Layer 3/4 balancers that redirect the incoming packets by NAPT are
|
||||
not expected to obtain any saving of time by using the flow label,
|
||||
because they have no choice but to follow the extension header
|
||||
chain in order to locate and modify the port number and transport
|
||||
checksum. The same would apply to balancers that perform TCP
|
||||
state tracking for any reason.
|
||||
|
||||
o Note that correct handling of ICMPv6 for Path MTU Discovery
|
||||
requires the layer 3/4 balancer to keep state for the client
|
||||
source address, independently of either the port numbers or the
|
||||
flow label.
|
||||
|
||||
o SSL and HTTP proxies, if present, should forward the flow label
|
||||
value towards the server. This usually has no performance
|
||||
benefit, but it is consistent with the general model for the flow
|
||||
label described in RFC 6437.
|
||||
|
||||
It should be noted that the performance benefit, if any, depends
|
||||
entirely on engineering trade-offs in the design of the layer 3/4
|
||||
balancer. An extra test is needed to check if the label is non-zero,
|
||||
but if there is a non-zero label, all logic for handling extension
|
||||
headers can be skipped except for the first packet of a new flow.
|
||||
Since the identifying state to be stored is only the tuple and the
|
||||
server identifier, storage requirements will be reduced.
|
||||
Additionally, the method will work for fragmented traffic and for
|
||||
flows where the transport information is missing (unknown transport
|
||||
protocol) or obfuscated (e.g., IPsec). Traffic reaching the load
|
||||
balancer via a VPN is particularly prone to the fragmentation issue,
|
||||
due to MTU size issues. For some load-balancer designs, these are
|
||||
very significant advantages.
|
||||
|
||||
In the unlikely event of two simultaneous flows from the same source
|
||||
address having the same flow label value, the two flows would end up
|
||||
assigned to the same server, where they would be distinguished as
|
||||
normal by their port numbers. There are approximately one million
|
||||
possible flow label values, and if the rules for flow label
|
||||
generation [RFC6437] are followed, this would be a statistically rare
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 9]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
event, and would not damage the overall load-balancing effect.
|
||||
Moreover, with a million possible label values, it is very likely
|
||||
that there will be many more flow label values than servers at most
|
||||
sites, so it is already expected that multiple flow label values will
|
||||
end up on the same server for a given client IP address.
|
||||
|
||||
In the case that many thousands of clients are hidden behind the same
|
||||
large-scale NAPT with a single shared IP address, the assumption of
|
||||
low probability of conflicts might become incorrect, unless flow
|
||||
label values are random enough to avoid following similar sequences
|
||||
for all clients. This is not expected to be a factor for IPv6
|
||||
anyway, since there is no need to implement large-scale NAPT with
|
||||
address sharing [RFC4864]. The probability of conflicts is low for
|
||||
sites that implement network prefix translation [RFC6296], since this
|
||||
technique provides a different address for each client.
|
||||
|
||||
5. Security Considerations
|
||||
|
||||
Security aspects of the flow label are discussed in [RFC6437]. As
|
||||
noted there, a malicious source or man-in-the-middle could disturb
|
||||
load balancing by manipulating flow labels. This risk already exists
|
||||
today where the source address and port are used as a hashing key in
|
||||
layer 3/4 load balancers, as well as where a persistence cookie is
|
||||
used in HTTP to designate a server. It even exists on layer 3
|
||||
components that only rely on the source address to select a
|
||||
destination, making them more DDoS-prone. Nevertheless, all these
|
||||
methods are currently used because the benefits for load balancing
|
||||
and persistence hugely outweigh the risks. The flow label does not
|
||||
significantly alter this situation.
|
||||
|
||||
Specifically, the IPv6 flow label specification [RFC6437] states that
|
||||
"stateless classifiers should not use the flow label alone to control
|
||||
load distribution, and stateful classifiers should include explicit
|
||||
methods to detect and ignore suspect flow label values." The former
|
||||
point is answered by also using the source address. The latter point
|
||||
is more complex. If the risk is considered serious, the site ingress
|
||||
router or the layer 3/4 balancer should use a suitable heuristic to
|
||||
verify incoming flows with non-zero flow label values. If a flow
|
||||
from a given source address and port number does not have a constant
|
||||
flow label value, it is suspect and should be dropped. This would
|
||||
deal with both intentional and accidental changes to the flow label.
|
||||
|
||||
A malicious source or man-in-the-middle could generate a flow in
|
||||
which the flow label is constant but the transport port numbers in
|
||||
some packets are invalid. Such packets, if load-balanced only on the
|
||||
basis of the flow label, could reach the target server and create a
|
||||
single-source DoS attack on its TCP engine.
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 10]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
RFC 6437 notes in its Security Considerations that if the covert
|
||||
channel risk is considered significant, a firewall might rewrite non-
|
||||
zero flow labels. As long as this is done as described in RFC 6437,
|
||||
it will not invalidate the mechanisms described above.
|
||||
|
||||
The flow label may be of use in protecting against DDoS attacks
|
||||
against servers. As noted in RFC 6437, a source should generate flow
|
||||
label values that are hard to predict, most likely by including a
|
||||
secret nonce in the hash used to generate each label. The attacker
|
||||
does not know the nonce and therefore has no way to invent flow
|
||||
labels that will all target the same server, even with knowledge of
|
||||
both the hash algorithm and the load-balancing algorithm. Still, it
|
||||
is important to understand that it is always trivial to force a load
|
||||
balancer to stick to the same server during an attack, so the
|
||||
security of the whole solution must not rely on the unpredictability
|
||||
of the flow label values alone, but should include defensive measures
|
||||
like most load balancers already have against abnormal use of source
|
||||
addresses or session cookies.
|
||||
|
||||
New flows are assigned to a server according to any of the usual
|
||||
algorithms available on the load balancer (e.g., least connections,
|
||||
round robin, etc.). The association between the 2-tuple {source
|
||||
address, flow label} and the server is stored in a table (often
|
||||
called stick table) so that future traffic from the same source using
|
||||
the same flow label can be sent to the same server. This method is
|
||||
more robust against a loss of server and also makes it harder for an
|
||||
attacker to target a specific server, because the association between
|
||||
a flow label value and a server is not known externally.
|
||||
|
||||
In the case that a stateless hash function is used to assign client
|
||||
packets to specific servers, it may be advisable to use a
|
||||
cryptographic hash function of some kind, to ensure that an attacker
|
||||
cannot predict the behavior of the load balancer.
|
||||
|
||||
6. Acknowledgements
|
||||
|
||||
Valuable comments and contributions were made by Fred Baker, Olivier
|
||||
Bonaventure, Ben Campbell, Lorenzo Colitti, Linda Dunbar, Donald
|
||||
Eastlake, Joel Jaeggli, Gurudeep Kamat, Warren Kumari, Julia
|
||||
Renouard, Julius Volz, and others.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 11]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
7. References
|
||||
|
||||
7.1. Normative References
|
||||
|
||||
[RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6
|
||||
(IPv6) Specification", RFC 2460, December 1998.
|
||||
|
||||
[RFC6434] Jankiewicz, E., Loughney, J., and T. Narten, "IPv6 Node
|
||||
Requirements", RFC 6434, December 2011.
|
||||
|
||||
[RFC6437] Amante, S., Carpenter, B., Jiang, S., and J. Rajahalme,
|
||||
"IPv6 Flow Label Specification", RFC 6437, November 2011.
|
||||
|
||||
7.2. Informative References
|
||||
|
||||
[RFC2991] Thaler, D. and C. Hopps, "Multipath Issues in Unicast and
|
||||
Multicast Next-Hop Selection", RFC 2991, November 2000.
|
||||
|
||||
[RFC4864] Van de Velde, G., Hain, T., Droms, R., Carpenter, B., and
|
||||
E. Klein, "Local Network Protection for IPv6", RFC 4864,
|
||||
May 2007.
|
||||
|
||||
[RFC6294] Hu, Q. and B. Carpenter, "Survey of Proposed Use Cases for
|
||||
the IPv6 Flow Label", RFC 6294, June 2011.
|
||||
|
||||
[RFC6296] Wasserman, M. and F. Baker, "IPv6-to-IPv6 Network Prefix
|
||||
Translation", RFC 6296, June 2011.
|
||||
|
||||
[RFC6436] Amante, S., Carpenter, B., and S. Jiang, "Rationale for
|
||||
Update to the IPv6 Flow Label Specification", RFC 6436,
|
||||
November 2011.
|
||||
|
||||
[RFC6438] Carpenter, B. and S. Amante, "Using the IPv6 Flow Label
|
||||
for Equal Cost Multipath Routing and Link Aggregation in
|
||||
Tunnels", RFC 6438, November 2011.
|
||||
|
||||
[Tarreau] Tarreau, W., "Making applications scalable with load
|
||||
balancing", 2006, <http://1wt.eu/articles/2006_lb/>.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 12]
|
||||
|
||||
RFC 7098 Flow Label for Server Load Balancing January 2014
|
||||
|
||||
|
||||
Authors' Addresses
|
||||
|
||||
Brian Carpenter
|
||||
Department of Computer Science
|
||||
University of Auckland
|
||||
PB 92019
|
||||
Auckland 1142
|
||||
New Zealand
|
||||
|
||||
EMail: brian.e.carpenter@gmail.com
|
||||
|
||||
|
||||
Sheng Jiang
|
||||
Huawei Technologies Co., Ltd
|
||||
Q14, Huawei Campus
|
||||
No.156 Beiqing Road
|
||||
Hai-Dian District, Beijing 100095
|
||||
P.R. China
|
||||
|
||||
EMail: jiangsheng@huawei.com
|
||||
|
||||
|
||||
Willy Tarreau
|
||||
HAProxy Technologies, Inc.
|
||||
R&D Network Products
|
||||
3 rue du petit Robinson
|
||||
78350 Jouy-en-Josas
|
||||
France
|
||||
|
||||
EMail: willy@haproxy.com
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Carpenter, et al. Informational [Page 13]
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,174 @@
|
|||
|
||||
|
||||
RFC 768 J. Postel
|
||||
ISI
|
||||
28 August 1980
|
||||
|
||||
|
||||
|
||||
User Datagram Protocol
|
||||
----------------------
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
This User Datagram Protocol (UDP) is defined to make available a
|
||||
datagram mode of packet-switched computer communication in the
|
||||
environment of an interconnected set of computer networks. This
|
||||
protocol assumes that the Internet Protocol (IP) [1] is used as the
|
||||
underlying protocol.
|
||||
|
||||
This protocol provides a procedure for application programs to send
|
||||
messages to other programs with a minimum of protocol mechanism. The
|
||||
protocol is transaction oriented, and delivery and duplicate protection
|
||||
are not guaranteed. Applications requiring ordered reliable delivery of
|
||||
streams of data should use the Transmission Control Protocol (TCP) [2].
|
||||
|
||||
Format
|
||||
------
|
||||
|
||||
|
||||
0 7 8 15 16 23 24 31
|
||||
+--------+--------+--------+--------+
|
||||
| Source | Destination |
|
||||
| Port | Port |
|
||||
+--------+--------+--------+--------+
|
||||
| | |
|
||||
| Length | Checksum |
|
||||
+--------+--------+--------+--------+
|
||||
|
|
||||
| data octets ...
|
||||
+---------------- ...
|
||||
|
||||
User Datagram Header Format
|
||||
|
||||
Fields
|
||||
------
|
||||
|
||||
Source Port is an optional field, when meaningful, it indicates the port
|
||||
of the sending process, and may be assumed to be the port to which a
|
||||
reply should be addressed in the absence of any other information. If
|
||||
not used, a value of zero is inserted.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Postel [page 1]
|
||||
|
||||
|
||||
28 Aug 1980
|
||||
User Datagram Protocol RFC 768
|
||||
Fields
|
||||
|
||||
|
||||
|
||||
Destination Port has a meaning within the context of a particular
|
||||
internet destination address.
|
||||
|
||||
Length is the length in octets of this user datagram including this
|
||||
header and the data. (This means the minimum value of the length is
|
||||
eight.)
|
||||
|
||||
Checksum is the 16-bit one's complement of the one's complement sum of a
|
||||
pseudo header of information from the IP header, the UDP header, and the
|
||||
data, padded with zero octets at the end (if necessary) to make a
|
||||
multiple of two octets.
|
||||
|
||||
The pseudo header conceptually prefixed to the UDP header contains the
|
||||
source address, the destination address, the protocol, and the UDP
|
||||
length. This information gives protection against misrouted datagrams.
|
||||
This checksum procedure is the same as is used in TCP.
|
||||
|
||||
0 7 8 15 16 23 24 31
|
||||
+--------+--------+--------+--------+
|
||||
| source address |
|
||||
+--------+--------+--------+--------+
|
||||
| destination address |
|
||||
+--------+--------+--------+--------+
|
||||
| zero |protocol| UDP length |
|
||||
+--------+--------+--------+--------+
|
||||
|
||||
If the computed checksum is zero, it is transmitted as all ones (the
|
||||
equivalent in one's complement arithmetic). An all zero transmitted
|
||||
checksum value means that the transmitter generated no checksum (for
|
||||
debugging or for higher level protocols that don't care).
|
||||
|
||||
User Interface
|
||||
--------------
|
||||
|
||||
A user interface should allow
|
||||
|
||||
the creation of new receive ports,
|
||||
|
||||
receive operations on the receive ports that return the data octets
|
||||
and an indication of source port and source address,
|
||||
|
||||
and an operation that allows a datagram to be sent, specifying the
|
||||
data, source and destination ports and addresses to be sent.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
[page 2] Postel
|
||||
|
||||
|
||||
28 Aug 1980
|
||||
RFC 768 User Datagram Protocol
|
||||
IP Interface
|
||||
|
||||
|
||||
|
||||
IP Interface
|
||||
-------------
|
||||
|
||||
The UDP module must be able to determine the source and destination
|
||||
internet addresses and the protocol field from the internet header. One
|
||||
possible UDP/IP interface would return the whole internet datagram
|
||||
including all of the internet header in response to a receive operation.
|
||||
Such an interface would also allow the UDP to pass a full internet
|
||||
datagram complete with header to the IP to send. The IP would verify
|
||||
certain fields for consistency and compute the internet header checksum.
|
||||
|
||||
Protocol Application
|
||||
--------------------
|
||||
|
||||
The major uses of this protocol is the Internet Name Server [3], and the
|
||||
Trivial File Transfer [4].
|
||||
|
||||
Protocol Number
|
||||
---------------
|
||||
|
||||
This is protocol 17 (21 octal) when used in the Internet Protocol.
|
||||
Other protocol numbers are listed in [5].
|
||||
|
||||
References
|
||||
----------
|
||||
|
||||
[1] Postel, J., "Internet Protocol," RFC 760, USC/Information
|
||||
Sciences Institute, January 1980.
|
||||
|
||||
[2] Postel, J., "Transmission Control Protocol," RFC 761,
|
||||
USC/Information Sciences Institute, January 1980.
|
||||
|
||||
[3] Postel, J., "Internet Name Server," USC/Information Sciences
|
||||
Institute, IEN 116, August 1979.
|
||||
|
||||
[4] Sollins, K., "The TFTP Protocol," Massachusetts Institute of
|
||||
Technology, IEN 133, January 1980.
|
||||
|
||||
[5] Postel, J., "Assigned Numbers," USC/Information Sciences
|
||||
Institute, RFC 762, January 1980.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Postel [page 3]
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,171 @@
|
|||
|
||||
|
||||
Network Working Group Charles Hornig
|
||||
Request for Comments: 894 Symbolics Cambridge Research Center
|
||||
April 1984
|
||||
|
||||
A Standard for the Transmission of IP Datagrams over Ethernet Networks
|
||||
|
||||
|
||||
Status of this Memo
|
||||
|
||||
This RFC specifies a standard method of encapsulating Internet
|
||||
Protocol (IP) [1] datagrams on an Ethernet [2]. This RFC specifies a
|
||||
standard protocol for the ARPA-Internet community.
|
||||
|
||||
Introduction
|
||||
|
||||
This memo applies to the Ethernet (10-megabit/second, 48-bit
|
||||
addresses). The procedure for transmission of IP datagrams on the
|
||||
Experimental Ethernet (3-megabit/second, 8-bit addresses) is
|
||||
described in [3].
|
||||
|
||||
Frame Format
|
||||
|
||||
IP datagrams are transmitted in standard Ethernet frames. The type
|
||||
field of the Ethernet frame must contain the value hexadecimal 0800.
|
||||
The data field contains the IP header followed immediately by the IP
|
||||
data.
|
||||
|
||||
The minimum length of the data field of a packet sent over an
|
||||
Ethernet is 46 octets. If necessary, the data field should be padded
|
||||
(with octets of zero) to meet the Ethernet minimum frame size. This
|
||||
padding is not part of the IP packet and is not included in the total
|
||||
length field of the IP header.
|
||||
|
||||
The minimum length of the data field of a packet sent over an
|
||||
Ethernet is 1500 octets, thus the maximum length of an IP datagram
|
||||
sent over an Ethernet is 1500 octets. Implementations are encouraged
|
||||
to support full-length packets. Gateway implementations MUST be
|
||||
prepared to accept full-length packets and fragment them if
|
||||
necessary. If a system cannot receive full-length packets, it should
|
||||
take steps to discourage others from sending them, such as using the
|
||||
TCP Maximum Segment Size option [4].
|
||||
|
||||
Note: Datagrams on the Ethernet may be longer than the general
|
||||
Internet default maximum packet size of 576 octets. Hosts connected
|
||||
to an Ethernet should keep this in mind when sending datagrams to
|
||||
hosts not on the same Ethernet. It may be appropriate to send
|
||||
smaller datagrams to avoid unnecessary fragmentation at intermediate
|
||||
gateways. Please see [4] for further information on this point.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hornig [Page 1]
|
||||
|
||||
|
||||
|
||||
RFC 894 April 1984
|
||||
|
||||
|
||||
Address Mappings
|
||||
|
||||
The mapping of 32-bit Internet addresses to 48-bit Ethernet addresses
|
||||
can be done several ways. A static table could be used, or a dynamic
|
||||
discovery procedure could be used.
|
||||
|
||||
Static Table
|
||||
|
||||
Each host could be provided with a table of all other hosts on the
|
||||
local network with both their Ethernet and Internet addresses.
|
||||
|
||||
Dynamic Discovery
|
||||
|
||||
Mappings between 32-bit Internet addresses and 48-bit Ethernet
|
||||
addresses could be accomplished through the Address Resolution
|
||||
Protocol (ARP) [5]. Internet addresses are assigned arbitrarily
|
||||
on some Internet network. Each host's implementation must know
|
||||
its own Internet address and respond to Ethernet Address
|
||||
Resolution packets appropriately. It should also use ARP to
|
||||
translate Internet addresses to Ethernet addresses when needed.
|
||||
|
||||
Broadcast Address
|
||||
|
||||
The broadcast Internet address (the address on that network with a
|
||||
host part of all binary ones) should be mapped to the broadcast
|
||||
Ethernet address (of all binary ones, FF-FF-FF-FF-FF-FF hex).
|
||||
|
||||
The use of the ARP dynamic discovery procedure is strongly
|
||||
recommended.
|
||||
|
||||
Trailer Formats
|
||||
|
||||
Some versions of Unix 4.2bsd use a different encapsulation method in
|
||||
order to get better network performance with the VAX virtual memory
|
||||
architecture. Consenting systems on the same Ethernet may use this
|
||||
format between themselves.
|
||||
|
||||
No host is required to implement it, and no datagrams in this format
|
||||
should be sent to any host unless the sender has positive knowledge
|
||||
that the recipient will be able to interpret them. Details of the
|
||||
trailer encapsulation may be found in [6].
|
||||
|
||||
(Note: At the present time Unix 4.2bsd will either always use
|
||||
trailers or never use them (per interface), depending on a boot-time
|
||||
option. This is expected to be changed in the future. Unix 4.2bsd
|
||||
also uses a non-standard Internet broadcast address with a host part
|
||||
of all zeroes, this may also be changed in the future.)
|
||||
|
||||
|
||||
|
||||
Hornig [Page 2]
|
||||
|
||||
|
||||
|
||||
RFC 894 April 1984
|
||||
|
||||
|
||||
Byte Order
|
||||
|
||||
As described in Appendix B of the Internet Protocol
|
||||
specification [1], the IP datagram is transmitted over the Ethernet
|
||||
as a series of 8-bit bytes.
|
||||
|
||||
References
|
||||
|
||||
[1] Postel, J., "Internet Protocol", RFC-791, USC/Information
|
||||
Sciences Institute, September 1981.
|
||||
|
||||
[2] "The Ethernet - A Local Area Network", Version 1.0, Digital
|
||||
Equipment Corporation, Intel Corporation, Xerox Corporation,
|
||||
September 1980.
|
||||
|
||||
[3] Postel, J., "A Standard for the Transmission of IP Datagrams
|
||||
over Experimental Ethernet Networks", RFC-895, USC/Information
|
||||
Sciences Institute, April 1984.
|
||||
|
||||
[4] Postel, J., "The TCP Maximum Segment Size Option and Related
|
||||
Topics", RFC-879, USC/Information Sciences Institute, November 1983.
|
||||
|
||||
[5] Plummer, D., "An Ethernet Address Resolution Protocol", RFC-826,
|
||||
Symbolics Cambridge Research Center, November 1982.
|
||||
|
||||
[6] Leffler, S., and M. Karels, "Trailer Encapsulations", RFC-893,
|
||||
University of California at Berkeley, April 1984.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Hornig [Page 3]
|
||||
|
|
@ -0,0 +1 @@
|
|||
(nil)
|
|
@ -0,0 +1,35 @@
|
|||
(defun ensure-package (package)
|
||||
(unless (package-installed-p package)
|
||||
(package-install package)))
|
||||
|
||||
(unless (file-directory-p "/home/kyle/.emacs.d/elpa/archives/melpa")
|
||||
(package-refresh-contents))
|
||||
|
||||
(let ((initial-package-list
|
||||
'(auto-complete
|
||||
cargo
|
||||
;; chess
|
||||
cider
|
||||
geiser
|
||||
;; gnugo
|
||||
go ;; play the game
|
||||
go-autocomplete
|
||||
go-direx
|
||||
go-guru
|
||||
go-mode
|
||||
jedi
|
||||
keychain-environment
|
||||
lua-mode
|
||||
luarocks
|
||||
magit
|
||||
markdown-mode
|
||||
paredit
|
||||
pelican-mode
|
||||
projectile
|
||||
racket-mode
|
||||
rust-mode
|
||||
scpaste
|
||||
slime
|
||||
undo-tree)))
|
||||
(dolist (package initial-package-list)
|
||||
(ensure-package package)))
|
|
@ -0,0 +1,29 @@
|
|||
;;; -*- coding: utf-8 -*-
|
||||
|
||||
;; ----- ido-last-directory-list -----
|
||||
(
|
||||
("/home/k.isom/kodiak/" . "ktos/")
|
||||
("/home/k.isom/" . "kodiak/")
|
||||
)
|
||||
|
||||
;; ----- ido-work-directory-list -----
|
||||
(
|
||||
"/home/k.isom/kodiak/ktos/"
|
||||
)
|
||||
|
||||
;; ----- ido-work-file-list -----
|
||||
(
|
||||
"README.org"
|
||||
)
|
||||
|
||||
;; ----- ido-dir-file-cache -----
|
||||
(
|
||||
("/home/k.isom/" (25647 820 345033 248000) ".local/" ".python_history" ".Xresources" ".aws.sh" ".aws/" "Downloads/" ".docker/" "./" ".npm/" ".sudo_as_admin_successful" ".bash_history" ".cache/" ".dmrc" ".bazelrc" ".bash_logout" ".profile.bak" "tmp/" ".config/" ".java/" ".mozilla/" "../" ".bashrc" "Pictures/" "src/" "obs.img" ".amplify/" ".gitconfig" "Music/" "Public/" ".pyenv/" "git/" ".lesshst" "token.txt" ".emacs.d/" ".profile" "snap/" ".viminfo" "kodiak/" ".yarn/" ".bazel/" "Documents/" ".GlobalProtect/" "Templates/" ".pki/" ".Xauthority" "Videos/" ".gnupg/" ".xsession-errors" "token.txt~" "java_error_in_clion_.hprof" "Desktop/" ".xsession-errors.old" ".ssh/")
|
||||
|
||||
("/home/k.isom/kodiak/ktos/" (25646 63617 378004 643000) "scripts/" "kodiak.xml" "./" "devtools.xml" "build-stack-from-source.xml" "device-table" "../" "cuda-tensorrt.xml" "nvidia-drivers.xml" "README.org" "rfs.xml" "initfs/" "update-syspart.sh" "rootfs/" "makefile" "xorg.xml" "reprepro.xml" "ifs.xml" ".git/")
|
||||
|
||||
("/home/k.isom/kodiak/" (25646 63612 290013 440000) "./" "vehicle/" "ktos/" "../")
|
||||
)
|
||||
|
||||
;; ----- ido-unc-hosts-cache -----
|
||||
t
|
|
@ -0,0 +1,209 @@
|
|||
;;; startup without syntax highlighting
|
||||
;;; (global-font-lock-mode 0)
|
||||
|
||||
;; set up package handling
|
||||
(require 'package)
|
||||
|
||||
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
|
||||
(add-to-list 'package-archives
|
||||
'("melpa" . "https://melpa.org/packages/"))
|
||||
|
||||
(package-initialize)
|
||||
(require 'cl)
|
||||
(let* ((home-dir (getenv "HOME"))
|
||||
(ensure-lisp (concatenate 'string home-dir "/.emacs.d/ensure.el")))
|
||||
(load ensure-lisp))
|
||||
|
||||
;; reduce brain damage
|
||||
(tool-bar-mode 0)
|
||||
(menu-bar-mode 0)
|
||||
(setq inhibit-startup-screen t)
|
||||
(setq display-time-24hr-format t)
|
||||
(display-time-mode)
|
||||
(column-number-mode)
|
||||
|
||||
;; useful when writing
|
||||
(global-set-key (kbd "C-c w") 'count-words)
|
||||
|
||||
;; remove whitespace to make room for more cyberspace
|
||||
(add-hook 'before-save-hook 'delete-trailing-whitespace)
|
||||
|
||||
;; hippie-expand is the best
|
||||
(require 'hippie-exp)
|
||||
(require 'auto-complete)
|
||||
(global-auto-complete-mode t)
|
||||
(ac-set-trigger-key "<C-tab>")
|
||||
(global-set-key (kbd "<C-tab>") 'ac-expand)
|
||||
|
||||
;; eshell is pretty okay
|
||||
(global-set-key (kbd "C-x m") 'eshell)
|
||||
|
||||
;; ido-mode makes finding files way more awesome
|
||||
;; note: C-x C-f C-f will kick back to normal find-file for when ido's tab
|
||||
;; completion is getting in the way.
|
||||
(require 'ido)
|
||||
(ido-mode 1)
|
||||
|
||||
;; magit, not yours
|
||||
(require 'magit)
|
||||
(global-set-key (kbd "C-x g") 'magit-status)
|
||||
|
||||
;; undo-tree is undo done right
|
||||
(require 'undo-tree)
|
||||
(global-undo-tree-mode)
|
||||
|
||||
;; i like refilling paragraphs
|
||||
(global-set-key (kbd "M-q") 'fill-paragraph)
|
||||
|
||||
;; i install things to /usr/local
|
||||
(add-to-list 'exec-path "/home/kyle/bin")
|
||||
(add-to-list 'exec-path "/usr/local/bin")
|
||||
|
||||
;; tell me where i'm at
|
||||
(column-number-mode)
|
||||
|
||||
;;; i like cua-rectangle
|
||||
(cua-mode t)
|
||||
(cua-selection-mode 'emacs)
|
||||
(global-set-key (kbd "M-RET") 'cua-rectangle-mark-mode)
|
||||
|
||||
(require 'scpaste)
|
||||
(setq scpaste-http-destination "https://p.kyleisom.net"
|
||||
scpaste-scp-destination "p.kyleisom.net:/var/www/sites/p/")
|
||||
|
||||
;;; useful for writing
|
||||
(global-set-key (kbd "C-x w") 'count-words)
|
||||
|
||||
;;; used with pollen
|
||||
(global-set-key (kbd "C-c C-d")
|
||||
(lambda () (interactive) (insert "\u25ca")))
|
||||
(add-to-list 'auto-mode-alist '("\\.poly.pm\\'" . text-mode))
|
||||
|
||||
(require 'markdown-mode)
|
||||
|
||||
;; python stuff
|
||||
(add-hook 'python-mode-hook 'jedi:setup)
|
||||
(setq jedi:complete-on-dot t) ; optional
|
||||
|
||||
;; golang stuff
|
||||
(setq gofmt-command "goimports")
|
||||
(require 'go-mode)
|
||||
(add-hook 'before-save-hook 'gofmt-before-save)
|
||||
|
||||
(when (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el"))
|
||||
(load (expand-file-name "~/quicklisp/slime-helper.el"))
|
||||
(ensure-package 'slime)
|
||||
;; Replace "sbcl" with the path to your implementation
|
||||
(setq inferior-lisp-program "sbcl")
|
||||
(slime-setup '(slime-fancy
|
||||
slime-autodoc
|
||||
slime-indentation))
|
||||
|
||||
(setq slime-net-coding-system 'utf-8-unix
|
||||
slime-truncate-lines nil)
|
||||
|
||||
(setq lisp-lambda-list-keyword-parameter-alignment t
|
||||
lisp-lambda-list-keyword-alignment t))
|
||||
|
||||
(add-to-list 'auto-mode-alist '("\\.ros\\'" . lisp-mode))
|
||||
|
||||
|
||||
(add-hook 'clojure-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'lisp-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'lisp-interaction-mode-hook #'enable-paredit-mode)
|
||||
(add-hook 'scheme-mode-hook #'enable-paredit-mode)
|
||||
|
||||
;;; rust stuff
|
||||
(add-hook 'rust-mode-hook #'racer-mode)
|
||||
(add-hook 'racer-mode-hook #'eldoc-mode)
|
||||
(add-hook 'racer-mode-hook #'company-mode)
|
||||
|
||||
(require 'rust-mode)
|
||||
(define-key rust-mode-map (kbd "TAB") #'company-indent-or-complete-common)
|
||||
(setq company-tooltip-align-annotations t)
|
||||
|
||||
;;; Project Interaction Library for Emacs
|
||||
(require 'projectile)
|
||||
(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
|
||||
(define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
|
||||
(setq projectile-project-search-path '("~/src/" "~/code/"))
|
||||
(projectile-mode +1)
|
||||
|
||||
|
||||
;;;
|
||||
;;; _:_
|
||||
;;; '-.-'
|
||||
;;; () __.'.__
|
||||
;;; .-:--:-. |_______|
|
||||
;;; () \____/ \=====/
|
||||
;;; /\ {====} )___(
|
||||
;;; (\=, //\\ )__( /_____\
|
||||
;;; __ |'-'-'| // .\ ( ) /____\ | |
|
||||
;;; / \ |_____| (( \_ \ )__( | | | |
|
||||
;;; \__/ |===| )) `\_) /____\ | | | |
|
||||
;;; /____\ | | (/ \ | | | | | |
|
||||
;;; | | | | | _.-'| | | | | | |
|
||||
;;; |__| )___( )___( /____\ /____\ /_____\
|
||||
;;; (====) (=====) (=====) (======) (======) (=======)
|
||||
;;; }===={ }====={ }====={ }======{ }======{ }======={
|
||||
;;; (______)(_______)(_______)(________)(________)(_________)
|
||||
(setq chess-ai-depth 2)
|
||||
|
||||
|
||||
(custom-set-variables
|
||||
;; custom-set-variables was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
'(ansi-color-names-vector
|
||||
["#2d3743" "#ff4242" "#74af68" "#dbdb95" "#34cae2" "#008b8b" "#00ede1" "#e1e1e0"])
|
||||
'(chess-default-display (quote chess-plain))
|
||||
'(custom-safe-themes
|
||||
(quote
|
||||
("bf390ecb203806cbe351b966a88fc3036f3ff68cd2547db6ee3676e87327b311" "e1943fd6568d49ec819ee3711c266a8a120e452ba08569045dd8f50cc5ec5dd3" "4561c67b0764aa6343d710bb0a6f3a96319252b2169d371802cc94adfea5cfc9" "5f95ce79b4a8870b3486b04de22ca2e0785b287da8779f512cdd847f42266989" default)))
|
||||
'(custom-theme-directory "~/.emacs.d/themes")
|
||||
'(global-font-lock-mode t)
|
||||
'(package-selected-packages
|
||||
(quote
|
||||
(yaml-mode projectile company-racer ac-racer racer erlang go-rename blackboard-bold-mode blacken jedi minimal-theme monochrome-theme monotropic-theme nimbus-theme noctilux-theme nord-theme nordless-theme northcode-theme paganini-theme paper-theme melancholy-theme go-imports guile-scheme slime chess pelican-mode gnugo go go-autocomplete go-direx go-guru go-mode markdown-mode irfc scpaste cargo undo-tree magit auto-complete))))
|
||||
(custom-set-faces
|
||||
;; custom-set-faces was added by Custom.
|
||||
;; If you edit it by hand, you could mess it up, so be careful.
|
||||
;; Your init file should contain only one such instance.
|
||||
;; If there is more than one, they won't work right.
|
||||
)
|
||||
|
||||
(setq +DEFAULT-THEME+ "weyland-yutani")
|
||||
(defun toggle-fontlock ()
|
||||
(if (font-lock-mode)
|
||||
(progn
|
||||
(message "disabling font-lock-mode")
|
||||
(global-font-lock-mode 0))
|
||||
(progn
|
||||
(message "enabling font-lock-mode")
|
||||
(load-theme +DEFAULT-THEME+)
|
||||
(global-font-lock-mode t))))
|
||||
|
||||
(put 'upcase-region 'disabled nil)
|
||||
(put 'downcase-region 'disabled nil)
|
||||
|
||||
(keychain-refresh-environment)
|
||||
(require 'ox-publish)
|
||||
(setq org-publish-project-alist
|
||||
'(("notes"
|
||||
:base-directory "~/notes/"
|
||||
:publishing-directory "/ssh:phobos.wntrmute.net:/var/www/sites/tmp/"
|
||||
:publishing-function org-html-publish-to-html
|
||||
:headline-levels 4 ; Just the default for this project.
|
||||
:auto-preamble t)
|
||||
("notes-static"
|
||||
:base-directory "~/notes/"
|
||||
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
|
||||
:publishing-directory "/ssh:phobos.wntrmute.net:/var/www/sites/tmp/"
|
||||
:recursive t
|
||||
:publishing-function org-publish-attachment)))
|
||||
|
||||
;;; Load fira-code support.
|
||||
(when (window-system)
|
||||
(set-frame-font "Ubuntu Mono 13"))
|
||||
;; (load "~/.emacs.d/fira-code.el")
|
|
@ -0,0 +1,256 @@
|
|||
;;; eink-dark-theme.el --- Emacs theme with a dark background.
|
||||
|
||||
;; Copyright (C) 2015, K. Isom
|
||||
|
||||
;; Author: K. Isom
|
||||
;; https://git.kyleisom.net/style/eink-emacs
|
||||
;; Version: 0.2
|
||||
;; Package-Requires: ((emacs "24"))
|
||||
;; Created with emacs-theme-generator, https://github.com/mswift42/theme-creator.
|
||||
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;; This file is not part of Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme eink-dark)
|
||||
(let ((class '((class color) (min-colors 89)))
|
||||
(fg1 "#b3b3b3")
|
||||
(fg2 "#a3a3a3")
|
||||
(fg3 "#949494")
|
||||
(fg4 "#858585")
|
||||
(bg1 "#1d1f21")
|
||||
(bg2 "#2c2e30")
|
||||
(bg3 "#3b3d3f")
|
||||
(bg4 "#4c4d4f")
|
||||
(key2 "#bbbbbb")
|
||||
(key3 "#9d9d9d")
|
||||
(builtin "#b3b3b3")
|
||||
(keyword "#b3b3b3")
|
||||
(const "#b3b3b3")
|
||||
(comment "#696969")
|
||||
(func "#b3b3b3")
|
||||
(str "#b3b3b3")
|
||||
(type "#b3b3b3")
|
||||
(var "#b3b3b3")
|
||||
(warning "#cd2626"))
|
||||
(custom-theme-set-faces
|
||||
'eink-dark
|
||||
`(default ((,class (:background ,bg1 :foreground ,fg1))))
|
||||
`(font-lock-builtin-face ((,class (:foreground ,builtin))))
|
||||
`(font-lock-comment-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-negation-char-face ((,class (:foreground ,const))))
|
||||
`(font-lock-reference-face ((,class (:foreground ,const))))
|
||||
`(font-lock-constant-face ((,class (:foreground ,const))))
|
||||
`(font-lock-doc-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-function-name-face ((,class (:foreground ,func :bold t))))
|
||||
`(font-lock-keyword-face ((,class (:bold ,class :foreground ,keyword))))
|
||||
`(font-lock-string-face ((,class (:foreground ,str))))
|
||||
`(font-lock-type-face ((,class (:foreground ,type ))))
|
||||
`(font-lock-variable-name-face ((,class (:foreground ,var))))
|
||||
`(font-lock-warning-face ((,class (:foreground ,warning :background ,bg2))))
|
||||
`(region ((,class (:background ,fg1 :foreground ,bg1))))
|
||||
`(highlight ((,class (:foreground ,fg3 :background ,bg3))))
|
||||
`(hl-line ((,class (:background ,bg2))))
|
||||
`(fringe ((,class (:background ,bg2 :foreground ,fg4))))
|
||||
`(cursor ((,class (:background ,bg3))))
|
||||
`(show-paren-match-face ((,class (:background ,warning))))
|
||||
`(isearch ((,class (:bold t :foreground ,warning :background ,bg3))))
|
||||
`(mode-line ((,class (:box (:line-width 1 :color nil) :bold t :foreground ,fg4 :background ,bg2))))
|
||||
`(mode-line-inactive ((,class (:box (:line-width 1 :color nil :style pressed-button) :foreground ,key3 :background ,bg1 :weight normal))))
|
||||
`(mode-line-buffer-id ((,class (:bold t :foreground ,func :background nil))))
|
||||
`(mode-line-highlight ((,class (:foreground ,keyword :box nil :weight bold))))
|
||||
`(mode-line-emphasis ((,class (:foreground ,fg1))))
|
||||
`(vertical-border ((,class (:foreground ,fg3))))
|
||||
`(minibuffer-prompt ((,class (:bold t :foreground ,keyword))))
|
||||
`(default-italic ((,class (:italic t))))
|
||||
`(link ((,class (:foreground ,const :underline t))))
|
||||
`(org-code ((,class (:foreground ,fg2))))
|
||||
`(org-hide ((,class (:foreground ,fg4))))
|
||||
`(org-level-1 ((,class (:bold t :foreground ,fg2 :height 1.1))))
|
||||
`(org-level-2 ((,class (:bold nil :foreground ,fg3))))
|
||||
`(org-level-3 ((,class (:bold t :foreground ,fg4))))
|
||||
`(org-level-4 ((,class (:bold nil :foreground ,bg4))))
|
||||
`(org-date ((,class (:underline t :foreground ,var) )))
|
||||
`(org-footnote ((,class (:underline t :foreground ,fg4))))
|
||||
`(org-link ((,class (:underline t :foreground ,type ))))
|
||||
`(org-special-keyword ((,class (:foreground ,func))))
|
||||
`(org-block ((,class (:foreground ,fg3))))
|
||||
`(org-quote ((,class (:inherit org-block :slant italic))))
|
||||
`(org-verse ((,class (:inherit org-block :slant italic))))
|
||||
`(org-todo ((,class (:box (:line-width 1 :color ,fg3) :foreground ,keyword :bold t))))
|
||||
`(org-done ((,class (:box (:line-width 1 :color ,bg3) :bold t :foreground ,bg4))))
|
||||
`(org-warning ((,class (:underline t :foreground ,warning))))
|
||||
`(org-agenda-structure ((,class (:weight bold :foreground ,fg3 :box (:color ,fg4) :background ,bg3))))
|
||||
`(org-agenda-date ((,class (:foreground ,var :height 1.1 ))))
|
||||
`(org-agenda-date-weekend ((,class (:weight normal :foreground ,fg4))))
|
||||
`(org-agenda-date-today ((,class (:weight bold :foreground ,keyword :height 1.4))))
|
||||
`(org-agenda-done ((,class (:foreground ,bg4))))
|
||||
`(org-scheduled ((,class (:foreground ,type))))
|
||||
`(org-scheduled-today ((,class (:foreground ,func :weight bold :height 1.2))))
|
||||
`(org-ellipsis ((,class (:foreground ,builtin))))
|
||||
`(org-verbatim ((,class (:foreground ,fg4))))
|
||||
`(org-document-info-keyword ((,class (:foreground ,func))))
|
||||
`(font-latex-bold-face ((,class (:foreground ,type))))
|
||||
`(font-latex-italic-face ((,class (:foreground ,key3 :italic t))))
|
||||
`(font-latex-string-face ((,class (:foreground ,str))))
|
||||
`(font-latex-match-reference-keywords ((,class (:foreground ,const))))
|
||||
`(font-latex-match-variable-keywords ((,class (:foreground ,var))))
|
||||
`(ido-only-match ((,class (:foreground ,warning))))
|
||||
`(org-sexp-date ((,class (:foreground ,fg4))))
|
||||
`(ido-first-match ((,class (:foreground ,keyword :bold t))))
|
||||
`(gnus-header-content ((,class (:foreground ,keyword))))
|
||||
`(gnus-header-from ((,class (:foreground ,var))))
|
||||
`(gnus-header-name ((,class (:foreground ,type))))
|
||||
`(gnus-header-subject ((,class (:foreground ,func :bold t))))
|
||||
`(mu4e-view-url-number-face ((,class (:foreground ,type))))
|
||||
`(mu4e-cited-1-face ((,class (:foreground ,fg2))))
|
||||
`(mu4e-cited-7-face ((,class (:foreground ,fg3))))
|
||||
`(mu4e-header-marks-face ((,class (:foreground ,type))))
|
||||
`(ffap ((,class (:foreground ,fg4))))
|
||||
`(js2-private-function-call ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,str))))
|
||||
`(js2-jsdoc-html-tag-name ((,class (:foreground ,key2))))
|
||||
`(js2-external-variable ((,class (:foreground ,type ))))
|
||||
`(js2-function-param ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-value ((,class (:foreground ,str))))
|
||||
`(js2-private-member ((,class (:foreground ,fg3))))
|
||||
`(js3-warning-face ((,class (:underline ,keyword))))
|
||||
`(js3-error-face ((,class (:underline ,warning))))
|
||||
`(js3-external-variable-face ((,class (:foreground ,var))))
|
||||
`(js3-function-param-face ((,class (:foreground ,key3))))
|
||||
`(js3-jsdoc-tag-face ((,class (:foreground ,keyword))))
|
||||
`(js3-instance-member-face ((,class (:foreground ,const))))
|
||||
`(warning ((,class (:foreground ,warning))))
|
||||
`(ac-completion-face ((,class (:underline t :foreground ,keyword))))
|
||||
`(info-quoted-name ((,class (:foreground ,builtin))))
|
||||
`(info-string ((,class (:foreground ,str))))
|
||||
`(icompletep-determined ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-current-face ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-default-face ((,class :foreground ,fg2)))
|
||||
`(undo-tree-visualizer-unmodified-face ((,class :foreground ,var)))
|
||||
`(undo-tree-visualizer-register-face ((,class :foreground ,type)))
|
||||
`(slime-repl-inputed-output-face ((,class (:foreground ,type))))
|
||||
`(trailing-whitespace ((,class :foreground nil :background ,warning)))
|
||||
`(rainbow-delimiters-depth-1-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-2-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-3-face ((,class :foreground ,var)))
|
||||
`(rainbow-delimiters-depth-4-face ((,class :foreground ,const)))
|
||||
`(rainbow-delimiters-depth-5-face ((,class :foreground ,keyword)))
|
||||
`(rainbow-delimiters-depth-6-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-7-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-8-face ((,class :foreground ,var)))
|
||||
`(magit-item-highlight ((,class :background ,bg3)))
|
||||
`(magit-section-heading ((,class (:foreground ,keyword :weight bold))))
|
||||
`(magit-hunk-heading ((,class (:background ,bg3))))
|
||||
`(magit-section-highlight ((,class (:background ,bg2))))
|
||||
`(magit-hunk-heading-highlight ((,class (:background ,bg3))))
|
||||
`(magit-diff-context-highlight ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(magit-diffstat-added ((,class (:foreground ,type))))
|
||||
`(magit-diffstat-removed ((,class (:foreground ,var))))
|
||||
`(magit-process-ok ((,class (:foreground ,func :weight bold))))
|
||||
`(magit-process-ng ((,class (:foreground ,warning :weight bold))))
|
||||
`(magit-branch ((,class (:foreground ,const :weight bold))))
|
||||
`(magit-log-author ((,class (:foreground ,fg3))))
|
||||
`(magit-hash ((,class (:foreground ,fg2))))
|
||||
`(magit-diff-file-header ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(lazy-highlight ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(term ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(term-color-black ((,class (:foreground ,bg3 :background ,bg3))))
|
||||
`(term-color-blue ((,class (:foreground ,func :background ,func))))
|
||||
`(term-color-red ((,class (:foreground ,keyword :background ,bg3))))
|
||||
`(term-color-green ((,class (:foreground ,type :background ,bg3))))
|
||||
`(term-color-yellow ((,class (:foreground ,var :background ,var))))
|
||||
`(term-color-magenta ((,class (:foreground ,builtin :background ,builtin))))
|
||||
`(term-color-cyan ((,class (:foreground ,str :background ,str))))
|
||||
`(term-color-white ((,class (:foreground ,fg2 :background ,fg2))))
|
||||
`(rainbow-delimiters-unmatched-face ((,class :foreground ,warning)))
|
||||
`(helm-header ((,class (:foreground ,fg2 :background ,bg1 :underline nil :box nil))))
|
||||
`(helm-source-header ((,class (:foreground ,keyword :background ,bg1 :underline nil :weight bold))))
|
||||
`(helm-selection ((,class (:background ,bg2 :underline nil))))
|
||||
`(helm-selection-line ((,class (:background ,bg2))))
|
||||
`(helm-visible-mark ((,class (:foreground ,bg1 :background ,bg3))))
|
||||
`(helm-candidate-number ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(helm-separator ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-time-zone-current ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-time-zone-home ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-not-saved ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-process ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-buffer-saved-out ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-buffer-size ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-ff-directory ((,class (:foreground ,func :background ,bg1 :weight bold))))
|
||||
`(helm-ff-file ((,class (:foreground ,fg1 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-executable ((,class (:foreground ,key2 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-invalid-symlink ((,class (:foreground ,key3 :background ,bg1 :weight bold))))
|
||||
`(helm-ff-symlink ((,class (:foreground ,keyword :background ,bg1 :weight bold))))
|
||||
`(helm-ff-prefix ((,class (:foreground ,bg1 :background ,keyword :weight normal))))
|
||||
`(helm-grep-cmd-line ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-file ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-finish ((,class (:foreground ,fg2 :background ,bg1))))
|
||||
`(helm-grep-lineno ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-match ((,class (:foreground nil :background nil :inherit helm-match))))
|
||||
`(helm-grep-running ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-moccur-buffer ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-source-go-package-godoc-description ((,class (:foreground ,str))))
|
||||
`(helm-bookmark-w3m ((,class (:foreground ,type))))
|
||||
`(company-echo-common ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(company-preview ((,class (:background ,bg1 :foreground ,key2))))
|
||||
`(company-preview-common ((,class (:foreground ,bg2 :foreground ,fg3))))
|
||||
`(company-preview-search ((,class (:foreground ,type :background ,bg1))))
|
||||
`(company-scrollbar-bg ((,class (:background ,bg3))))
|
||||
`(company-scrollbar-fg ((,class (:foreground ,keyword))))
|
||||
`(company-tooltip ((,class (:foreground ,fg2 :background ,bg1 :bold t))))
|
||||
`(company-tooltop-annotation ((,class (:foreground ,const))))
|
||||
`(company-tooltip-common ((,class ( :foreground ,fg3))))
|
||||
`(company-tooltip-common-selection ((,class (:foreground ,str))))
|
||||
`(company-tooltip-mouse ((,class (:inherit highlight))))
|
||||
`(company-tooltip-selection ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(company-template-field ((,class (:inherit region))))
|
||||
`(web-mode-builtin-face ((,class (:inherit ,font-lock-builtin-face))))
|
||||
`(web-mode-comment-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-constant-face ((,class (:inherit ,font-lock-constant-face))))
|
||||
`(web-mode-keyword-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-doctype-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-function-name-face ((,class (:inherit ,font-lock-function-name-face))))
|
||||
`(web-mode-string-face ((,class (:foreground ,str))))
|
||||
`(web-mode-type-face ((,class (:inherit ,font-lock-type-face))))
|
||||
`(web-mode-html-attr-name-face ((,class (:foreground ,func))))
|
||||
`(web-mode-html-attr-value-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-warning-face ((,class (:inherit ,font-lock-warning-face))))
|
||||
`(web-mode-html-tag-face ((,class (:foreground ,builtin))))
|
||||
`(jde-java-font-lock-package-face ((t (:foreground ,var))))
|
||||
`(jde-java-font-lock-public-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-private-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-constant-face ((t (:foreground ,const))))
|
||||
`(jde-java-font-lock-modifier-face ((t (:foreground ,key3))))
|
||||
`(jde-jave-font-lock-protected-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-number-face ((t (:foreground ,var))))))
|
||||
|
||||
;;;###autoload
|
||||
(when load-file-name
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(file-name-as-directory (file-name-directory load-file-name))))
|
||||
|
||||
(provide-theme 'eink-dark)
|
||||
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
|
||||
;;; eink-dark-theme.el ends here
|
||||
|
|
@ -0,0 +1,256 @@
|
|||
;;; eink-light-theme.el --- Emacs theme with a light background.
|
||||
|
||||
;; Copyright (C) 2015, K. Isom
|
||||
|
||||
;; Author: K. Isom
|
||||
;; https://git.kyleisom.net/style/eink-emacs
|
||||
;; Version: 0.2
|
||||
;; Package-Requires: ((emacs "24"))
|
||||
;; Created with emacs-theme-generator, https://github.com/mswift42/theme-creator.
|
||||
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;; This file is not part of Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme eink-light)
|
||||
(let ((class '((class color) (min-colors 89)))
|
||||
(fg1 "#1c1c1c")
|
||||
(fg2 "#2b2b2b")
|
||||
(fg3 "#3a3a3a")
|
||||
(fg4 "#4b4b4b")
|
||||
(bg1 "#fffafa")
|
||||
(bg2 "#e8e3e3")
|
||||
(bg3 "#d1cdcd")
|
||||
(bg4 "#bbb8b8")
|
||||
(key2 "#313131")
|
||||
(key3 "#1a1a1a")
|
||||
(builtin "#1c1c1c")
|
||||
(keyword "#1c1c1c")
|
||||
(const "#1c1c1c")
|
||||
(comment "#7f7f7f")
|
||||
(func "#1c1c1c")
|
||||
(str "#1c1c1c")
|
||||
(type "#1c1c1c")
|
||||
(var "#1c1c1c")
|
||||
(warning "#cd2626"))
|
||||
(custom-theme-set-faces
|
||||
'eink-light
|
||||
`(default ((,class (:background ,bg1 :foreground ,fg1))))
|
||||
`(font-lock-builtin-face ((,class (:foreground ,builtin))))
|
||||
`(font-lock-comment-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-negation-char-face ((,class (:foreground ,const))))
|
||||
`(font-lock-reference-face ((,class (:foreground ,const))))
|
||||
`(font-lock-constant-face ((,class (:foreground ,const))))
|
||||
`(font-lock-doc-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-function-name-face ((,class (:foreground ,func :bold t))))
|
||||
`(font-lock-keyword-face ((,class (:bold ,class :foreground ,keyword))))
|
||||
`(font-lock-string-face ((,class (:foreground ,str))))
|
||||
`(font-lock-type-face ((,class (:foreground ,type ))))
|
||||
`(font-lock-variable-name-face ((,class (:foreground ,var))))
|
||||
`(font-lock-warning-face ((,class (:foreground ,warning :background ,bg2))))
|
||||
`(region ((,class (:background ,fg1 :foreground ,bg1))))
|
||||
`(highlight ((,class (:foreground ,fg3 :background ,bg3))))
|
||||
`(hl-line ((,class (:background ,bg2))))
|
||||
`(fringe ((,class (:background ,bg2 :foreground ,fg4))))
|
||||
`(cursor ((,class (:background ,bg3))))
|
||||
`(show-paren-match-face ((,class (:background ,warning))))
|
||||
`(isearch ((,class (:bold t :foreground ,warning :background ,bg3))))
|
||||
`(mode-line ((,class (:box (:line-width 1 :color nil) :bold t :foreground ,fg4 :background ,bg2))))
|
||||
`(mode-line-inactive ((,class (:box (:line-width 1 :color nil :style pressed-button) :foreground ,key3 :background ,bg1 :weight normal))))
|
||||
`(mode-line-buffer-id ((,class (:bold t :foreground ,func :background nil))))
|
||||
`(mode-line-highlight ((,class (:foreground ,keyword :box nil :weight bold))))
|
||||
`(mode-line-emphasis ((,class (:foreground ,fg1))))
|
||||
`(vertical-border ((,class (:foreground ,fg3))))
|
||||
`(minibuffer-prompt ((,class (:bold t :foreground ,keyword))))
|
||||
`(default-italic ((,class (:italic t))))
|
||||
`(link ((,class (:foreground ,const :underline t))))
|
||||
`(org-code ((,class (:foreground ,fg2))))
|
||||
`(org-hide ((,class (:foreground ,fg4))))
|
||||
`(org-level-1 ((,class (:bold t :foreground ,fg2 :height 1.1))))
|
||||
`(org-level-2 ((,class (:bold nil :foreground ,fg3))))
|
||||
`(org-level-3 ((,class (:bold t :foreground ,fg4))))
|
||||
`(org-level-4 ((,class (:bold nil :foreground ,bg4))))
|
||||
`(org-date ((,class (:underline t :foreground ,var) )))
|
||||
`(org-footnote ((,class (:underline t :foreground ,fg4))))
|
||||
`(org-link ((,class (:underline t :foreground ,type ))))
|
||||
`(org-special-keyword ((,class (:foreground ,func))))
|
||||
`(org-block ((,class (:foreground ,fg3))))
|
||||
`(org-quote ((,class (:inherit org-block :slant italic))))
|
||||
`(org-verse ((,class (:inherit org-block :slant italic))))
|
||||
`(org-todo ((,class (:box (:line-width 1 :color ,fg3) :foreground ,keyword :bold t))))
|
||||
`(org-done ((,class (:box (:line-width 1 :color ,bg3) :bold t :foreground ,bg4))))
|
||||
`(org-warning ((,class (:underline t :foreground ,warning))))
|
||||
`(org-agenda-structure ((,class (:weight bold :foreground ,fg3 :box (:color ,fg4) :background ,bg3))))
|
||||
`(org-agenda-date ((,class (:foreground ,var :height 1.1 ))))
|
||||
`(org-agenda-date-weekend ((,class (:weight normal :foreground ,fg4))))
|
||||
`(org-agenda-date-today ((,class (:weight bold :foreground ,keyword :height 1.4))))
|
||||
`(org-agenda-done ((,class (:foreground ,bg4))))
|
||||
`(org-scheduled ((,class (:foreground ,type))))
|
||||
`(org-scheduled-today ((,class (:foreground ,func :weight bold :height 1.2))))
|
||||
`(org-ellipsis ((,class (:foreground ,builtin))))
|
||||
`(org-verbatim ((,class (:foreground ,fg4))))
|
||||
`(org-document-info-keyword ((,class (:foreground ,func))))
|
||||
`(font-latex-bold-face ((,class (:foreground ,type))))
|
||||
`(font-latex-italic-face ((,class (:foreground ,key3 :italic t))))
|
||||
`(font-latex-string-face ((,class (:foreground ,str))))
|
||||
`(font-latex-match-reference-keywords ((,class (:foreground ,const))))
|
||||
`(font-latex-match-variable-keywords ((,class (:foreground ,var))))
|
||||
`(ido-only-match ((,class (:foreground ,warning))))
|
||||
`(org-sexp-date ((,class (:foreground ,fg4))))
|
||||
`(ido-first-match ((,class (:foreground ,keyword :bold t))))
|
||||
`(gnus-header-content ((,class (:foreground ,keyword))))
|
||||
`(gnus-header-from ((,class (:foreground ,var))))
|
||||
`(gnus-header-name ((,class (:foreground ,type))))
|
||||
`(gnus-header-subject ((,class (:foreground ,func :bold t))))
|
||||
`(mu4e-view-url-number-face ((,class (:foreground ,type))))
|
||||
`(mu4e-cited-1-face ((,class (:foreground ,fg2))))
|
||||
`(mu4e-cited-7-face ((,class (:foreground ,fg3))))
|
||||
`(mu4e-header-marks-face ((,class (:foreground ,type))))
|
||||
`(ffap ((,class (:foreground ,fg4))))
|
||||
`(js2-private-function-call ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,str))))
|
||||
`(js2-jsdoc-html-tag-name ((,class (:foreground ,key2))))
|
||||
`(js2-external-variable ((,class (:foreground ,type ))))
|
||||
`(js2-function-param ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-value ((,class (:foreground ,str))))
|
||||
`(js2-private-member ((,class (:foreground ,fg3))))
|
||||
`(js3-warning-face ((,class (:underline ,keyword))))
|
||||
`(js3-error-face ((,class (:underline ,warning))))
|
||||
`(js3-external-variable-face ((,class (:foreground ,var))))
|
||||
`(js3-function-param-face ((,class (:foreground ,key3))))
|
||||
`(js3-jsdoc-tag-face ((,class (:foreground ,keyword))))
|
||||
`(js3-instance-member-face ((,class (:foreground ,const))))
|
||||
`(warning ((,class (:foreground ,warning))))
|
||||
`(ac-completion-face ((,class (:underline t :foreground ,keyword))))
|
||||
`(info-quoted-name ((,class (:foreground ,builtin))))
|
||||
`(info-string ((,class (:foreground ,str))))
|
||||
`(icompletep-determined ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-current-face ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-default-face ((,class :foreground ,fg2)))
|
||||
`(undo-tree-visualizer-unmodified-face ((,class :foreground ,var)))
|
||||
`(undo-tree-visualizer-register-face ((,class :foreground ,type)))
|
||||
`(slime-repl-inputed-output-face ((,class (:foreground ,type))))
|
||||
`(trailing-whitespace ((,class :foreground nil :background ,warning)))
|
||||
`(rainbow-delimiters-depth-1-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-2-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-3-face ((,class :foreground ,var)))
|
||||
`(rainbow-delimiters-depth-4-face ((,class :foreground ,const)))
|
||||
`(rainbow-delimiters-depth-5-face ((,class :foreground ,keyword)))
|
||||
`(rainbow-delimiters-depth-6-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-7-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-8-face ((,class :foreground ,var)))
|
||||
`(magit-item-highlight ((,class :background ,bg3)))
|
||||
`(magit-section-heading ((,class (:foreground ,keyword :weight bold))))
|
||||
`(magit-hunk-heading ((,class (:background ,bg3))))
|
||||
`(magit-section-highlight ((,class (:background ,bg2))))
|
||||
`(magit-hunk-heading-highlight ((,class (:background ,bg3))))
|
||||
`(magit-diff-context-highlight ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(magit-diffstat-added ((,class (:foreground ,type))))
|
||||
`(magit-diffstat-removed ((,class (:foreground ,var))))
|
||||
`(magit-process-ok ((,class (:foreground ,func :weight bold))))
|
||||
`(magit-process-ng ((,class (:foreground ,warning :weight bold))))
|
||||
`(magit-branch ((,class (:foreground ,const :weight bold))))
|
||||
`(magit-log-author ((,class (:foreground ,fg3))))
|
||||
`(magit-hash ((,class (:foreground ,fg2))))
|
||||
`(magit-diff-file-header ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(lazy-highlight ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(term ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(term-color-black ((,class (:foreground ,bg3 :background ,bg3))))
|
||||
`(term-color-blue ((,class (:foreground ,func :background ,func))))
|
||||
`(term-color-red ((,class (:foreground ,keyword :background ,bg3))))
|
||||
`(term-color-green ((,class (:foreground ,type :background ,bg3))))
|
||||
`(term-color-yellow ((,class (:foreground ,var :background ,var))))
|
||||
`(term-color-magenta ((,class (:foreground ,builtin :background ,builtin))))
|
||||
`(term-color-cyan ((,class (:foreground ,str :background ,str))))
|
||||
`(term-color-white ((,class (:foreground ,fg2 :background ,fg2))))
|
||||
`(rainbow-delimiters-unmatched-face ((,class :foreground ,warning)))
|
||||
`(helm-header ((,class (:foreground ,fg2 :background ,bg1 :underline nil :box nil))))
|
||||
`(helm-source-header ((,class (:foreground ,keyword :background ,bg1 :underline nil :weight bold))))
|
||||
`(helm-selection ((,class (:background ,bg2 :underline nil))))
|
||||
`(helm-selection-line ((,class (:background ,bg2))))
|
||||
`(helm-visible-mark ((,class (:foreground ,bg1 :background ,bg3))))
|
||||
`(helm-candidate-number ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(helm-separator ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-time-zone-current ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-time-zone-home ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-not-saved ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-process ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-buffer-saved-out ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-buffer-size ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-ff-directory ((,class (:foreground ,func :background ,bg1 :weight bold))))
|
||||
`(helm-ff-file ((,class (:foreground ,fg1 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-executable ((,class (:foreground ,key2 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-invalid-symlink ((,class (:foreground ,key3 :background ,bg1 :weight bold))))
|
||||
`(helm-ff-symlink ((,class (:foreground ,keyword :background ,bg1 :weight bold))))
|
||||
`(helm-ff-prefix ((,class (:foreground ,bg1 :background ,keyword :weight normal))))
|
||||
`(helm-grep-cmd-line ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-file ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-finish ((,class (:foreground ,fg2 :background ,bg1))))
|
||||
`(helm-grep-lineno ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-match ((,class (:foreground nil :background nil :inherit helm-match))))
|
||||
`(helm-grep-running ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-moccur-buffer ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-source-go-package-godoc-description ((,class (:foreground ,str))))
|
||||
`(helm-bookmark-w3m ((,class (:foreground ,type))))
|
||||
`(company-echo-common ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(company-preview ((,class (:background ,bg1 :foreground ,key2))))
|
||||
`(company-preview-common ((,class (:foreground ,bg2 :foreground ,fg3))))
|
||||
`(company-preview-search ((,class (:foreground ,type :background ,bg1))))
|
||||
`(company-scrollbar-bg ((,class (:background ,bg3))))
|
||||
`(company-scrollbar-fg ((,class (:foreground ,keyword))))
|
||||
`(company-tooltip ((,class (:foreground ,fg2 :background ,bg1 :bold t))))
|
||||
`(company-tooltop-annotation ((,class (:foreground ,const))))
|
||||
`(company-tooltip-common ((,class ( :foreground ,fg3))))
|
||||
`(company-tooltip-common-selection ((,class (:foreground ,str))))
|
||||
`(company-tooltip-mouse ((,class (:inherit highlight))))
|
||||
`(company-tooltip-selection ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(company-template-field ((,class (:inherit region))))
|
||||
`(web-mode-builtin-face ((,class (:inherit ,font-lock-builtin-face))))
|
||||
`(web-mode-comment-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-constant-face ((,class (:inherit ,font-lock-constant-face))))
|
||||
`(web-mode-keyword-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-doctype-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-function-name-face ((,class (:inherit ,font-lock-function-name-face))))
|
||||
`(web-mode-string-face ((,class (:foreground ,str))))
|
||||
`(web-mode-type-face ((,class (:inherit ,font-lock-type-face))))
|
||||
`(web-mode-html-attr-name-face ((,class (:foreground ,func))))
|
||||
`(web-mode-html-attr-value-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-warning-face ((,class (:inherit ,font-lock-warning-face))))
|
||||
`(web-mode-html-tag-face ((,class (:foreground ,builtin))))
|
||||
`(jde-java-font-lock-package-face ((t (:foreground ,var))))
|
||||
`(jde-java-font-lock-public-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-private-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-constant-face ((t (:foreground ,const))))
|
||||
`(jde-java-font-lock-modifier-face ((t (:foreground ,key3))))
|
||||
`(jde-jave-font-lock-protected-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-number-face ((t (:foreground ,var))))))
|
||||
|
||||
;;;###autoload
|
||||
(when load-file-name
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(file-name-as-directory (file-name-directory load-file-name))))
|
||||
|
||||
(provide-theme 'eink-light)
|
||||
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
|
||||
;;; eink-light-theme.el ends here
|
||||
|
|
@ -0,0 +1,271 @@
|
|||
|
||||
|
||||
;;; weyland-yutani-theme.el --- Emacs theme with a dark background.
|
||||
|
||||
;; Copyright (C) 2014 , Joe Staursky
|
||||
|
||||
;; Author: Joe Staursky
|
||||
;;
|
||||
;; Version: 0.1
|
||||
;; Package-Requires: ((emacs "24"))
|
||||
;; Created with emacs-theme-generator, https://github.com/mswift42/theme-creator.
|
||||
|
||||
|
||||
;; This program is free software: you can redistribute it and/or modify
|
||||
;; it under the terms of the GNU General Public License as published by
|
||||
;; the Free Software Foundation, either version 3 of the License, or
|
||||
;; (at your option) any later version.
|
||||
|
||||
;; This program is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;; GNU General Public License for more details.
|
||||
|
||||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
;; This file is not part of Emacs.
|
||||
|
||||
;;; Commentary:
|
||||
|
||||
;;; Code:
|
||||
|
||||
(deftheme weyland-yutani)
|
||||
(let ((class '((class color) (min-colors 89)))
|
||||
(fg1 "#a0a8b8")
|
||||
(fg2 "#9299a8")
|
||||
(fg3 "#848b98")
|
||||
(fg4 "#777d88")
|
||||
(bg1 "#141e20")
|
||||
(bg2 "#232d2f")
|
||||
(bg3 "#333c3e")
|
||||
(bg4 "#444d4e")
|
||||
(key2 "#a0e88b")
|
||||
(key3 "#82c96e")
|
||||
(builtin "#a3646f")
|
||||
(keyword "#93e57c")
|
||||
(const "#d1d68b")
|
||||
(comment "#565766")
|
||||
(func "#beb7f7")
|
||||
(str "#627e95")
|
||||
(type "#5992c2")
|
||||
(var "#9e79b3")
|
||||
(warning "#fcbec9"))
|
||||
(custom-theme-set-faces
|
||||
'weyland-yutani
|
||||
`(default ((,class (:background ,bg1 :foreground ,fg1))))
|
||||
`(font-lock-builtin-face ((,class (:foreground ,builtin))))
|
||||
`(company-tooltip-annotation-selection ((,class (:foreground ,func))))
|
||||
|
||||
`(company-tooltip-annotation ((,class (:foreground ,const))))
|
||||
|
||||
`(font-lock-comment-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-negation-char-face ((,class (:foreground ,const))))
|
||||
`(font-lock-reference-face ((,class (:foreground ,const))))
|
||||
`(font-lock-constant-face ((,class (:foreground ,const))))
|
||||
`(font-lock-doc-face ((,class (:foreground ,comment))))
|
||||
`(font-lock-function-name-face ((,class (:foreground ,func :bold t))))
|
||||
`(font-lock-keyword-face ((,class (:bold ,class :foreground ,keyword))))
|
||||
`(font-lock-string-face ((,class (:foreground ,str))))
|
||||
`(font-lock-type-face ((,class (:foreground ,type ))))
|
||||
`(font-lock-variable-name-face ((,class (:foreground ,var))))
|
||||
`(font-lock-warning-face ((,class (:foreground ,warning :background ,bg2))))
|
||||
`(region ((,class (:background ,fg1 :foreground ,bg1))))
|
||||
`(highlight ((,class (:foreground ,fg3 :background ,bg3))))
|
||||
`(hl-line ((,class (:background ,bg2))))
|
||||
`(fringe ((,class (:background ,bg2 :foreground ,fg4))))
|
||||
`(cursor ((,class (:background ,bg3))))
|
||||
`(show-paren-match-face ((,class (:background ,warning))))
|
||||
`(isearch ((,class (:bold t :foreground ,warning :background ,bg3))))
|
||||
`(mode-line ((,class (:box (:line-width 1 :color nil) :bold t :foreground ,fg4 :background ,bg2))))
|
||||
`(mode-line-inactive ((,class (:box (:line-width 1 :color nil :style pressed-button) :foreground ,key3 :background ,bg1 :weight normal))))
|
||||
`(mode-line-buffer-id ((,class (:bold t :foreground ,func :background nil))))
|
||||
`(mode-line-highlight ((,class (:foreground ,keyword :box nil :weight bold))))
|
||||
`(mode-line-emphasis ((,class (:foreground ,fg1))))
|
||||
`(vertical-border ((,class (:foreground ,fg3))))
|
||||
`(minibuffer-prompt ((,class (:bold t :foreground ,keyword))))
|
||||
`(default-italic ((,class (:italic t))))
|
||||
`(link ((,class (:foreground ,const :underline t))))
|
||||
`(org-code ((,class (:foreground ,fg2))))
|
||||
`(org-hide ((,class (:foreground ,fg4))))
|
||||
`(org-level-1 ((,class (:bold t :foreground ,fg2 :height 1.1))))
|
||||
`(org-level-2 ((,class (:bold nil :foreground ,fg3))))
|
||||
`(org-level-3 ((,class (:bold t :foreground ,fg4))))
|
||||
`(org-level-4 ((,class (:bold nil :foreground ,bg4))))
|
||||
`(org-date ((,class (:underline t :foreground ,var) )))
|
||||
`(org-footnote ((,class (:underline t :foreground ,fg4))))
|
||||
`(org-link ((,class (:underline t :foreground ,type ))))
|
||||
`(org-special-keyword ((,class (:foreground ,func))))
|
||||
`(org-block ((,class (:foreground ,fg3))))
|
||||
`(org-quote ((,class (:inherit org-block :slant italic))))
|
||||
`(org-verse ((,class (:inherit org-block :slant italic))))
|
||||
`(org-todo ((,class (:box (:line-width 1 :color ,fg3) :foreground ,keyword :bold t))))
|
||||
`(org-done ((,class (:box (:line-width 1 :color ,bg3) :bold t :foreground ,bg4))))
|
||||
`(org-warning ((,class (:underline t :foreground ,warning))))
|
||||
`(org-agenda-structure ((,class (:weight bold :foreground ,fg3 :box (:color ,fg4) :background ,bg3))))
|
||||
`(org-agenda-date ((,class (:foreground ,var :height 1.1 ))))
|
||||
`(org-agenda-date-weekend ((,class (:weight normal :foreground ,fg4))))
|
||||
`(org-agenda-date-today ((,class (:weight bold :foreground ,keyword :height 1.4))))
|
||||
`(org-agenda-done ((,class (:foreground ,bg4))))
|
||||
`(org-scheduled ((,class (:foreground ,type))))
|
||||
`(org-scheduled-today ((,class (:foreground ,func :weight bold :height 1.2))))
|
||||
`(org-ellipsis ((,class (:foreground ,builtin))))
|
||||
`(org-verbatim ((,class (:foreground ,fg4))))
|
||||
`(org-document-info-keyword ((,class (:foreground ,func))))
|
||||
`(font-latex-bold-face ((,class (:foreground ,type))))
|
||||
`(font-latex-italic-face ((,class (:foreground ,key3 :italic t))))
|
||||
`(font-latex-string-face ((,class (:foreground ,str))))
|
||||
`(font-latex-match-reference-keywords ((,class (:foreground ,const))))
|
||||
`(font-latex-match-variable-keywords ((,class (:foreground ,var))))
|
||||
`(ido-only-match ((,class (:foreground ,warning))))
|
||||
`(org-sexp-date ((,class (:foreground ,fg4))))
|
||||
`(ido-first-match ((,class (:foreground ,keyword :bold t))))
|
||||
`(gnus-header-content ((,class (:foreground ,keyword))))
|
||||
`(gnus-header-from ((,class (:foreground ,var))))
|
||||
`(gnus-header-name ((,class (:foreground ,type))))
|
||||
`(gnus-header-subject ((,class (:foreground ,func :bold t))))
|
||||
`(mu4e-view-url-number-face ((,class (:foreground ,type))))
|
||||
`(mu4e-cited-1-face ((,class (:foreground ,fg2))))
|
||||
`(mu4e-cited-7-face ((,class (:foreground ,fg3))))
|
||||
`(mu4e-header-marks-face ((,class (:foreground ,type))))
|
||||
`(ffap ((,class (:foreground ,fg4))))
|
||||
`(js2-private-function-call ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-html-tag-delimiter ((,class (:foreground ,str))))
|
||||
`(js2-jsdoc-html-tag-name ((,class (:foreground ,key2))))
|
||||
`(js2-external-variable ((,class (:foreground ,type ))))
|
||||
`(js2-function-param ((,class (:foreground ,const))))
|
||||
`(js2-jsdoc-value ((,class (:foreground ,str))))
|
||||
`(js2-private-member ((,class (:foreground ,fg3))))
|
||||
`(js3-warning-face ((,class (:underline ,keyword))))
|
||||
`(js3-error-face ((,class (:underline ,warning))))
|
||||
`(js3-external-variable-face ((,class (:foreground ,var))))
|
||||
`(js3-function-param-face ((,class (:foreground ,key3))))
|
||||
`(js3-jsdoc-tag-face ((,class (:foreground ,keyword))))
|
||||
`(js3-instance-member-face ((,class (:foreground ,const))))
|
||||
`(warning ((,class (:foreground ,warning))))
|
||||
`(ac-completion-face ((,class (:underline t :foreground ,keyword))))
|
||||
`(info-quoted-name ((,class (:foreground ,builtin))))
|
||||
`(info-string ((,class (:foreground ,str))))
|
||||
`(icompletep-determined ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-current-face ((,class :foreground ,builtin)))
|
||||
`(undo-tree-visualizer-default-face ((,class :foreground ,fg2)))
|
||||
`(undo-tree-visualizer-unmodified-face ((,class :foreground ,var)))
|
||||
`(undo-tree-visualizer-register-face ((,class :foreground ,type)))
|
||||
`(slime-repl-inputed-output-face ((,class (:foreground ,type))))
|
||||
`(trailing-whitespace ((,class :foreground nil :background ,warning)))
|
||||
`(rainbow-delimiters-depth-1-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-2-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-3-face ((,class :foreground ,var)))
|
||||
`(rainbow-delimiters-depth-4-face ((,class :foreground ,const)))
|
||||
`(rainbow-delimiters-depth-5-face ((,class :foreground ,keyword)))
|
||||
`(rainbow-delimiters-depth-6-face ((,class :foreground ,fg1)))
|
||||
`(rainbow-delimiters-depth-7-face ((,class :foreground ,type)))
|
||||
`(rainbow-delimiters-depth-8-face ((,class :foreground ,var)))
|
||||
`(magit-item-highlight ((,class :background ,bg3)))
|
||||
`(magit-section-heading ((,class (:foreground ,keyword :weight bold))))
|
||||
`(magit-hunk-heading ((,class (:background ,bg3))))
|
||||
`(magit-section-highlight ((,class (:background ,bg2))))
|
||||
`(magit-hunk-heading-highlight ((,class (:background ,bg3))))
|
||||
`(magit-diff-context-highlight ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(magit-diffstat-added ((,class (:foreground ,type))))
|
||||
`(magit-diffstat-removed ((,class (:foreground ,var))))
|
||||
`(magit-process-ok ((,class (:foreground ,func :weight bold))))
|
||||
`(magit-process-ng ((,class (:foreground ,warning :weight bold))))
|
||||
`(magit-branch ((,class (:foreground ,const :weight bold))))
|
||||
`(magit-log-author ((,class (:foreground ,fg3))))
|
||||
`(magit-hash ((,class (:foreground ,fg2))))
|
||||
`(magit-diff-file-header ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(lazy-highlight ((,class (:foreground ,fg2 :background ,bg3))))
|
||||
`(term ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(term-color-black ((,class (:foreground ,bg3 :background ,bg3))))
|
||||
`(term-color-blue ((,class (:foreground ,func :background ,func))))
|
||||
`(term-color-red ((,class (:foreground ,keyword :background ,bg3))))
|
||||
`(term-color-green ((,class (:foreground ,type :background ,bg3))))
|
||||
`(term-color-yellow ((,class (:foreground ,var :background ,var))))
|
||||
`(term-color-magenta ((,class (:foreground ,builtin :background ,builtin))))
|
||||
`(term-color-cyan ((,class (:foreground ,str :background ,str))))
|
||||
`(term-color-white ((,class (:foreground ,fg2 :background ,fg2))))
|
||||
`(rainbow-delimiters-unmatched-face ((,class :foreground ,warning)))
|
||||
`(helm-header ((,class (:foreground ,fg2 :background ,bg1 :underline nil :box nil))))
|
||||
`(helm-source-header ((,class (:foreground ,keyword :background ,bg1 :underline nil :weight bold))))
|
||||
`(helm-selection ((,class (:background ,bg2 :underline nil))))
|
||||
`(helm-selection-line ((,class (:background ,bg2))))
|
||||
`(helm-visible-mark ((,class (:foreground ,bg1 :background ,bg3))))
|
||||
`(helm-candidate-number ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(helm-separator ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-time-zone-current ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-time-zone-home ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-not-saved ((,class (:foreground ,type :background ,bg1))))
|
||||
`(helm-buffer-process ((,class (:foreground ,builtin :background ,bg1))))
|
||||
`(helm-buffer-saved-out ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-buffer-size ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-ff-directory ((,class (:foreground ,func :background ,bg1 :weight bold))))
|
||||
`(helm-ff-file ((,class (:foreground ,fg1 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-executable ((,class (:foreground ,key2 :background ,bg1 :weight normal))))
|
||||
`(helm-ff-invalid-symlink ((,class (:foreground ,key3 :background ,bg1 :weight bold))))
|
||||
`(helm-ff-symlink ((,class (:foreground ,keyword :background ,bg1 :weight bold))))
|
||||
`(helm-ff-prefix ((,class (:foreground ,bg1 :background ,keyword :weight normal))))
|
||||
`(helm-grep-cmd-line ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-file ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-finish ((,class (:foreground ,fg2 :background ,bg1))))
|
||||
`(helm-grep-lineno ((,class (:foreground ,fg1 :background ,bg1))))
|
||||
`(helm-grep-match ((,class (:foreground nil :background nil :inherit helm-match))))
|
||||
`(helm-grep-running ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-moccur-buffer ((,class (:foreground ,func :background ,bg1))))
|
||||
`(helm-source-go-package-godoc-description ((,class (:foreground ,str))))
|
||||
`(helm-bookmark-w3m ((,class (:foreground ,type))))
|
||||
|
||||
|
||||
|
||||
`(company-echo ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(company-preview ((,class (:background ,bg1 :foreground ,key2))))
|
||||
`(company-tooltip ((,class (:foreground ,fg2 :background ,bg1 :bold t))))
|
||||
`(company-echo-common ((,class (:foreground ,bg1 :background ,fg1))))
|
||||
`(company-scrollbar-bg ((,class (:background ,bg3))))
|
||||
`(company-scrollbar-fg ((,class (:foreground ,keyword))))
|
||||
`(company-tooltip-mouse ((,class (:inherit highlight))))
|
||||
`(company-preview-common ((,class (:foreground ,bg2 :foreground ,fg3))))
|
||||
`(company-template-field ((,class (:inherit region))))
|
||||
`(company-tooltop-search ((,class (:inherit region))))
|
||||
`(company-tooltip-common ((,class ( :foreground ,fg3))))
|
||||
`(company-preview-search ((,class (:foreground ,type :background ,bg1))))
|
||||
`(company-tooltip-selection ((,class (:background ,bg3 :foreground ,fg3))))
|
||||
`(company-tooltop-annotation ((,class (:foreground ,const))))
|
||||
`(company-tooltip-common-selection ((,class (:foreground ,str))))
|
||||
`(company-tooltop-search-selection ((,class (:foreground ,const))))
|
||||
`(company-tooltop-annotation-selection ((,class (:foreground ,const))))
|
||||
`(web-mode-builtin-face ((,class (:inherit ,font-lock-builtin-face))))
|
||||
`(web-mode-comment-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-constant-face ((,class (:inherit ,font-lock-constant-face))))
|
||||
`(web-mode-keyword-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-doctype-face ((,class (:inherit ,font-lock-comment-face))))
|
||||
`(web-mode-function-name-face ((,class (:inherit ,font-lock-function-name-face))))
|
||||
`(web-mode-string-face ((,class (:foreground ,str))))
|
||||
`(web-mode-type-face ((,class (:inherit ,font-lock-type-face))))
|
||||
`(web-mode-html-attr-name-face ((,class (:foreground ,func))))
|
||||
`(web-mode-html-attr-value-face ((,class (:foreground ,keyword))))
|
||||
`(web-mode-warning-face ((,class (:inherit ,font-lock-warning-face))))
|
||||
`(web-mode-html-tag-face ((,class (:foreground ,builtin))))
|
||||
`(jde-java-font-lock-package-face ((t (:foreground ,var))))
|
||||
`(jde-java-font-lock-public-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-private-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-constant-face ((t (:foreground ,const))))
|
||||
`(jde-java-font-lock-modifier-face ((t (:foreground ,key3))))
|
||||
`(jde-jave-font-lock-protected-face ((t (:foreground ,keyword))))
|
||||
`(jde-java-font-lock-number-face ((t (:foreground ,var))))
|
||||
|
||||
|
||||
))
|
||||
|
||||
;;;###autoload
|
||||
(when load-file-name
|
||||
(add-to-list 'custom-theme-load-path
|
||||
(file-name-as-directory (file-name-directory load-file-name))))
|
||||
|
||||
(provide-theme 'weyland-yutani)
|
||||
|
||||
;; Local Variables:
|
||||
;; no-byte-compile: t
|
||||
;; End:
|
||||
|
||||
;;; weyland-yutani-theme.el ends here
|
|
@ -0,0 +1 @@
|
|||
nil
|
|
@ -0,0 +1,19 @@
|
|||
[user]
|
||||
name = Kyle Isom
|
||||
email = kyle@imap.cc
|
||||
|
||||
[color]
|
||||
ui = false
|
||||
|
||||
[core]
|
||||
excludesfile = /home/kyle/.gitignore_global
|
||||
editor = mg
|
||||
|
||||
[http]
|
||||
cookiefile = /home/kyle/.gitcookies
|
||||
|
||||
[init]
|
||||
defaultBranch = master
|
||||
|
||||
[push]
|
||||
default = simple
|
|
@ -0,0 +1,5 @@
|
|||
*~
|
||||
*#
|
||||
.#*
|
||||
.*.sw?
|
||||
tags
|
|
@ -0,0 +1,34 @@
|
|||
# example user config (see 'hg help config' for more info)
|
||||
[ui]
|
||||
# name and email, e.g.
|
||||
# username = Jane Doe <jdoe@example.com>
|
||||
username = Kyle Isom <kyle@imap.cc>
|
||||
editor = /usr/bin/mg
|
||||
|
||||
# We recommend enabling tweakdefaults to get slight improvements to
|
||||
# the UI over time. Make sure to set HGPLAIN in the environment when
|
||||
# writing scripts!
|
||||
tweakdefaults = True
|
||||
|
||||
# uncomment to disable color in command output
|
||||
# (see 'hg help color' for details)
|
||||
color = never
|
||||
|
||||
# uncomment to disable command output pagination
|
||||
# (see 'hg help pager' for details)
|
||||
paginate = never
|
||||
|
||||
[extensions]
|
||||
# uncomment the lines below to enable some popular extensions
|
||||
# (see 'hg help extensions' for more info)
|
||||
#
|
||||
histedit =
|
||||
rebase =
|
||||
shelve =
|
||||
uncommit =
|
||||
hgext.mq=
|
||||
hgext.patchbomb=
|
||||
purge=
|
||||
|
||||
[diff]
|
||||
git = True
|
|
@ -0,0 +1,3 @@
|
|||
column-number-mode
|
||||
backup-to-home-directory
|
||||
bksp-mode
|
|
@ -0,0 +1,33 @@
|
|||
# ~/.profile: executed by the command interpreter for login shells.
|
||||
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
|
||||
# exists.
|
||||
# see /usr/share/doc/bash/examples/startup-files for examples.
|
||||
# the files are located in the bash-doc package.
|
||||
|
||||
# the default umask is set in /etc/profile; for setting the umask
|
||||
# for ssh logins, install and configure the libpam-umask package.
|
||||
#umask 022
|
||||
|
||||
# if running bash
|
||||
if [ -n "$BASH_VERSION" ]; then
|
||||
# include .bashrc if it exists
|
||||
if [ -f "$HOME/.bashrc" ]; then
|
||||
. "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/bin" ] ; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# set PATH so it includes user's private bin if it exists
|
||||
if [ -d "$HOME/.local/bin" ] ; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
|
||||
[ -f ~/.cargo/env ] && source $HOME/.cargo/env
|
||||
|
||||
alias co='git checkout'
|
||||
alias st='git status'
|
||||
alias prb='git pull --rebase'
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,189 @@
|
|||
" vim:sw=8:ts=8
|
||||
"
|
||||
" act like t_Co=0 but use (256) color on just a few things
|
||||
"
|
||||
|
||||
hi clear
|
||||
if exists("syntax_on")
|
||||
syntax reset
|
||||
endif
|
||||
|
||||
let colors_name = "eink"
|
||||
|
||||
if !has('gui_running')
|
||||
if &background == "light"
|
||||
hi Normal cterm=NONE ctermbg=white ctermfg=235
|
||||
hi SpecialKey cterm=bold ctermfg=NONE
|
||||
hi IncSearch cterm=reverse ctermfg=NONE
|
||||
hi Search cterm=reverse ctermfg=NONE
|
||||
hi MoreMsg cterm=bold ctermfg=NONE
|
||||
hi ModeMsg cterm=bold ctermfg=NONE
|
||||
hi LineNr cterm=NONE ctermfg=235
|
||||
hi StatusLine cterm=bold,reverse ctermfg=NONE
|
||||
hi StatusLineNC cterm=reverse ctermfg=NONE
|
||||
hi VertSplit cterm=reverse ctermfg=NONE
|
||||
hi Title cterm=bold ctermfg=NONE
|
||||
hi Visual cterm=reverse ctermfg=NONE
|
||||
hi VisualNOS cterm=bold ctermfg=NONE
|
||||
hi WarningMsg cterm=standout ctermfg=NONE
|
||||
hi WildMenu cterm=standout ctermfg=NONE
|
||||
hi Folded cterm=standout ctermfg=NONE
|
||||
hi FoldColumn cterm=standout ctermfg=NONE
|
||||
hi DiffAdd cterm=bold ctermfg=NONE
|
||||
hi DiffChange cterm=bold ctermfg=NONE
|
||||
hi DiffDelete cterm=bold ctermfg=NONE
|
||||
hi DiffText cterm=reverse ctermfg=NONE
|
||||
hi Type cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Keyword cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Number cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Char cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Format cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Special cterm=underline ctermbg=NONE ctermfg=NONE
|
||||
hi Constant cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi PreProc cterm=None ctermfg=NONE
|
||||
hi Directive cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Conditional cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Comment cterm=bold ctermbg=NONE ctermfg=240
|
||||
hi Func cterm=None ctermbg=234 ctermfg=250
|
||||
hi Identifier cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Statement cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Ignore cterm=bold ctermfg=NONE
|
||||
hi String term=underline ctermfg=NONE
|
||||
hi ErrorMsg cterm=reverse ctermbg=15 ctermfg=9
|
||||
hi Error cterm=reverse ctermbg=15 ctermfg=9
|
||||
hi Todo cterm=bold,standout ctermbg=0 ctermfg=11
|
||||
hi MatchParen cterm=bold ctermbg=250 ctermfg=NONE
|
||||
hi ColorColumn ctermbg=255
|
||||
else
|
||||
hi Normal cterm=NONE ctermbg=234 ctermfg=250
|
||||
hi SpecialKey cterm=bold ctermfg=NONE
|
||||
hi IncSearch cterm=reverse ctermfg=NONE
|
||||
hi Search cterm=reverse ctermfg=NONE
|
||||
hi MoreMsg cterm=bold ctermfg=NONE
|
||||
hi ModeMsg cterm=bold ctermfg=NONE
|
||||
hi LineNr cterm=NONE ctermfg=238
|
||||
hi StatusLine cterm=bold,reverse ctermfg=NONE
|
||||
hi StatusLineNC cterm=reverse ctermfg=NONE
|
||||
hi VertSplit cterm=reverse ctermfg=NONE
|
||||
hi Title cterm=bold ctermfg=NONE
|
||||
hi Visual cterm=reverse ctermfg=NONE
|
||||
hi VisualNOS cterm=bold ctermfg=NONE
|
||||
hi WarningMsg cterm=standout ctermfg=NONE
|
||||
hi WildMenu cterm=standout ctermfg=NONE
|
||||
hi Folded cterm=standout ctermfg=NONE
|
||||
hi FoldColumn cterm=standout ctermfg=NONE
|
||||
hi DiffAdd cterm=bold ctermfg=NONE
|
||||
hi DiffChange cterm=bold ctermfg=NONE
|
||||
hi DiffDelete cterm=bold ctermfg=NONE
|
||||
hi DiffText cterm=reverse ctermfg=NONE
|
||||
hi Type cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Keyword cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Number cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Char cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Format cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi Special cterm=underline ctermbg=NONE ctermfg=NONE
|
||||
hi Constant cterm=None ctermbg=NONE ctermfg=NONE
|
||||
hi PreProc cterm=None ctermfg=NONE
|
||||
hi Directive cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Conditional cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Comment cterm=NONE ctermbg=NONE ctermfg=245
|
||||
hi Func cterm=None ctermbg=234 ctermfg=250
|
||||
hi Identifier cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Statement cterm=NONE ctermbg=NONE ctermfg=NONE
|
||||
hi Ignore cterm=bold ctermfg=NONE
|
||||
hi String cterm=underline ctermfg=NONE
|
||||
hi ErrorMsg cterm=reverse ctermbg=15 ctermfg=9
|
||||
hi Error cterm=reverse ctermbg=15 ctermfg=9
|
||||
hi Todo cterm=bold,standout ctermbg=0 ctermfg=11
|
||||
hi MatchParen cterm=bold ctermbg=250 ctermfg=NONE
|
||||
hi ColorColumn ctermbg=255
|
||||
endif
|
||||
else
|
||||
if &background == "light"
|
||||
hi Normal gui=NONE guibg=snow1 guifg=gray11
|
||||
hi SpecialKey gui=bold guifg=NONE
|
||||
hi IncSearch gui=reverse guifg=NONE
|
||||
hi Search gui=reverse guifg=NONE
|
||||
hi MoreMsg gui=bold guifg=NONE
|
||||
hi ModeMsg gui=bold guifg=NONE
|
||||
hi LineNr gui=NONE guifg=gray60
|
||||
hi StatusLine gui=bold,reverse guifg=NONE
|
||||
hi StatusLineNC gui=reverse guifg=NONE
|
||||
hi VertSplit gui=reverse guifg=NONE
|
||||
hi Title gui=bold guifg=NONE
|
||||
hi Visual gui=reverse guifg=NONE
|
||||
hi VisualNOS gui=bold guifg=NONE
|
||||
hi WarningMsg gui=standout guifg=NONE
|
||||
hi WildMenu gui=standout guifg=NONE
|
||||
hi Folded gui=standout guifg=NONE
|
||||
hi FoldColumn gui=standout guifg=NONE
|
||||
hi DiffAdd gui=bold guifg=NONE
|
||||
hi DiffChange gui=bold guifg=NONE
|
||||
hi DiffDelete gui=bold guifg=NONE
|
||||
hi DiffText gui=reverse guifg=NONE
|
||||
hi Type gui=None guibg=NONE guifg=NONE
|
||||
hi Keyword gui=None guibg=NONE guifg=NONE
|
||||
hi Number gui=None guibg=NONE guifg=NONE
|
||||
hi Char gui=None guibg=NONE guifg=NONE
|
||||
hi Format gui=None guibg=NONE guifg=NONE
|
||||
hi Special gui=underline guibg=NONE guifg=NONE
|
||||
hi Constant gui=None guibg=NONE guifg=NONE
|
||||
hi PreProc gui=None guifg=NONE
|
||||
hi Directive gui=NONE guibg=NONE guifg=NONE
|
||||
hi Conditional gui=NONE guibg=NONE guifg=NONE
|
||||
hi Comment gui=bold guibg=NONE guifg=gray17
|
||||
hi Func gui=None guibg=NONE guifg=gray17
|
||||
hi Identifier gui=NONE guibg=NONE guifg=NONE
|
||||
hi Statement gui=NONE guibg=NONE guifg=NONE
|
||||
hi Ignore gui=bold guifg=NONE
|
||||
hi String term=italic guifg=NONE
|
||||
hi ErrorMsg gui=reverse guibg=NONE guifg=firebrick3
|
||||
hi Error gui=reverse guibg=NONE guifg=firebrick3
|
||||
hi Todo gui=bold,standout guibg=NONE guifg=darkgoldenrod2
|
||||
hi MatchParen gui=bold guibg=gray70 guifg=NONE
|
||||
hi ColorColumn guifg=gray60
|
||||
else
|
||||
hi Normal gui=NONE guibg=#1d1f21 guifg=gray70
|
||||
hi SpecialKey gui=bold guifg=NONE
|
||||
hi IncSearch gui=reverse guifg=NONE
|
||||
hi Search gui=reverse guifg=NONE
|
||||
hi MoreMsg gui=bold guifg=NONE
|
||||
hi ModeMsg gui=bold guifg=NONE
|
||||
hi LineNr gui=NONE guifg=gray30
|
||||
hi StatusLine gui=bold,reverse guifg=NONE
|
||||
hi StatusLineNC gui=reverse guifg=NONE
|
||||
hi VertSplit gui=reverse guifg=NONE
|
||||
hi Title gui=bold guifg=NONE
|
||||
hi Visual gui=reverse guifg=NONE
|
||||
hi VisualNOS gui=bold guifg=NONE
|
||||
hi WarningMsg gui=standout guifg=NONE
|
||||
hi WildMenu gui=standout guifg=NONE
|
||||
hi Folded gui=standout guifg=NONE
|
||||
hi FoldColumn gui=standout guifg=NONE
|
||||
hi DiffAdd gui=bold guifg=NONE
|
||||
hi DiffChange gui=bold guifg=NONE
|
||||
hi DiffDelete gui=bold guifg=NONE
|
||||
hi DiffText gui=reverse guifg=NONE
|
||||
hi Type gui=None guibg=NONE guifg=NONE
|
||||
hi Keyword gui=None guibg=NONE guifg=NONE
|
||||
hi Number gui=None guibg=NONE guifg=NONE
|
||||
hi Char gui=None guibg=NONE guifg=NONE
|
||||
hi Format gui=None guibg=NONE guifg=NONE
|
||||
hi Special gui=underline guibg=NONE guifg=NONE
|
||||
hi Constant gui=None guibg=NONE guifg=NONE
|
||||
hi PreProc gui=None guifg=NONE
|
||||
hi Directive gui=NONE guibg=NONE guifg=NONE
|
||||
hi Conditional gui=NONE guibg=NONE guifg=NONE
|
||||
hi Comment gui=NONE guibg=NONE guifg=gray50
|
||||
hi Func gui=None guibg=NONE guifg=gray50
|
||||
hi Identifier gui=NONE guibg=NONE guifg=NONE
|
||||
hi Statement gui=NONE guibg=NONE guifg=NONE
|
||||
hi Ignore gui=bold guifg=NONE
|
||||
hi String gui=italic guifg=NONE
|
||||
hi ErrorMsg gui=reverse guibg=NONE guifg=firebrick3
|
||||
hi Error gui=reverse guibg=NONE guifg=firebrick3
|
||||
hi Todo gui=bold,standout guibg=NONE guifg=darkgoldenrod2
|
||||
hi MatchParen gui=bold guibg=gray45 guifg=NONE
|
||||
hi ColorColumn guibg=gray10
|
||||
endif
|
||||
endif
|
|
@ -0,0 +1 @@
|
|||
setlocal omnifunc=gocomplete#Complete
|
|
@ -0,0 +1,63 @@
|
|||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" fmt.vim: Vim command to format Go files with gofmt.
|
||||
"
|
||||
" This filetype plugin add a new commands for go buffers:
|
||||
"
|
||||
" :Fmt
|
||||
"
|
||||
" Filter the current Go buffer through gofmt.
|
||||
" It tries to preserve cursor position and avoids
|
||||
" replacing the buffer with stderr output.
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" g:go_fmt_commands [default=1]
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
"
|
||||
if exists("b:did_ftplugin_go_fmt")
|
||||
finish
|
||||
endif
|
||||
|
||||
|
||||
if !exists("g:go_fmt_commands")
|
||||
let g:go_fmt_commands = 1
|
||||
endif
|
||||
|
||||
|
||||
if g:go_fmt_commands
|
||||
command! -buffer Fmt call s:GoFormat()
|
||||
endif
|
||||
|
||||
function! s:GoFormat()
|
||||
let view = winsaveview()
|
||||
silent %!gofmt
|
||||
if v:shell_error
|
||||
let errors = []
|
||||
for line in getline(1, line('$'))
|
||||
let tokens = matchlist(line, '^\(.\{-}\):\(\d\+\):\(\d\+\)\s*\(.*\)')
|
||||
if !empty(tokens)
|
||||
call add(errors, {"filename": @%,
|
||||
\"lnum": tokens[2],
|
||||
\"col": tokens[3],
|
||||
\"text": tokens[4]})
|
||||
endif
|
||||
endfor
|
||||
if empty(errors)
|
||||
% | " Couldn't detect gofmt error format, output errors
|
||||
endif
|
||||
undo
|
||||
if !empty(errors)
|
||||
call setloclist(0, errors, 'r')
|
||||
endif
|
||||
echohl Error | echomsg "Gofmt returned error" | echohl None
|
||||
endif
|
||||
call winrestview(view)
|
||||
endfunction
|
||||
|
||||
let b:did_ftplugin_go_fmt = 1
|
||||
|
||||
" vim:ts=4:sw=4:et
|
|
@ -0,0 +1,250 @@
|
|||
" Copyright 2011 The Go Authors. All rights reserved.
|
||||
" Use of this source code is governed by a BSD-style
|
||||
" license that can be found in the LICENSE file.
|
||||
"
|
||||
" import.vim: Vim commands to import/drop Go packages.
|
||||
"
|
||||
" This filetype plugin adds three new commands for go buffers:
|
||||
"
|
||||
" :Import {path}
|
||||
"
|
||||
" Import ensures that the provided package {path} is imported
|
||||
" in the current Go buffer, using proper style and ordering.
|
||||
" If {path} is already being imported, an error will be
|
||||
" displayed and the buffer will be untouched.
|
||||
"
|
||||
" :ImportAs {localname} {path}
|
||||
"
|
||||
" Same as Import, but uses a custom local name for the package.
|
||||
"
|
||||
" :Drop {path}
|
||||
"
|
||||
" Remove the import line for the provided package {path}, if
|
||||
" present in the current Go buffer. If {path} is not being
|
||||
" imported, an error will be displayed and the buffer will be
|
||||
" untouched.
|
||||
"
|
||||
" If you would like to add shortcuts, you can do so by doing the following:
|
||||
"
|
||||
" Import fmt
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>f :Import fmt<CR>
|
||||
"
|
||||
" Drop fmt
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>F :Drop fmt<CR>
|
||||
"
|
||||
" Import the word under your cursor
|
||||
" au Filetype go nnoremap <buffer> <LocalLeader>k
|
||||
" \ :exe 'Import ' . expand('<cword>')<CR>
|
||||
"
|
||||
" The backslash '\' is the default maplocalleader, so it is possible that
|
||||
" your vim is set to use a different character (:help maplocalleader).
|
||||
"
|
||||
" Options:
|
||||
"
|
||||
" g:go_import_commands [default=1]
|
||||
"
|
||||
" Flag to indicate whether to enable the commands listed above.
|
||||
"
|
||||
if exists("b:did_ftplugin_go_import")
|
||||
finish
|
||||
endif
|
||||
|
||||
if !exists("g:go_import_commands")
|
||||
let g:go_import_commands = 1
|
||||
endif
|
||||
|
||||
if g:go_import_commands
|
||||
command! -buffer -nargs=? -complete=customlist,go#complete#Package Drop call s:SwitchImport(0, '', <f-args>)
|
||||
command! -buffer -nargs=1 -complete=customlist,go#complete#Package Import call s:SwitchImport(1, '', <f-args>)
|
||||
command! -buffer -nargs=* -complete=customlist,go#complete#Package ImportAs call s:SwitchImport(1, <f-args>)
|
||||
endif
|
||||
|
||||
function! s:SwitchImport(enabled, localname, path)
|
||||
let view = winsaveview()
|
||||
let path = a:path
|
||||
|
||||
" Quotes are not necessary, so remove them if provided.
|
||||
if path[0] == '"'
|
||||
let path = strpart(path, 1)
|
||||
endif
|
||||
if path[len(path)-1] == '"'
|
||||
let path = strpart(path, 0, len(path) - 1)
|
||||
endif
|
||||
if path == ''
|
||||
call s:Error('Import path not provided')
|
||||
return
|
||||
endif
|
||||
|
||||
" Extract any site prefix (e.g. github.com/).
|
||||
" If other imports with the same prefix are grouped separately,
|
||||
" we will add this new import with them.
|
||||
" Only up to and including the first slash is used.
|
||||
let siteprefix = matchstr(path, "^[^/]*/")
|
||||
|
||||
let qpath = '"' . path . '"'
|
||||
if a:localname != ''
|
||||
let qlocalpath = a:localname . ' ' . qpath
|
||||
else
|
||||
let qlocalpath = qpath
|
||||
endif
|
||||
let indentstr = 0
|
||||
let packageline = -1 " Position of package name statement
|
||||
let appendline = -1 " Position to introduce new import
|
||||
let deleteline = -1 " Position of line with existing import
|
||||
let linesdelta = 0 " Lines added/removed
|
||||
|
||||
" Find proper place to add/remove import.
|
||||
let line = 0
|
||||
while line <= line('$')
|
||||
let linestr = getline(line)
|
||||
|
||||
if linestr =~# '^package\s'
|
||||
let packageline = line
|
||||
let appendline = line
|
||||
|
||||
elseif linestr =~# '^import\s\+('
|
||||
let appendstr = qlocalpath
|
||||
let indentstr = 1
|
||||
let appendline = line
|
||||
let firstblank = -1
|
||||
let lastprefix = ""
|
||||
while line <= line("$")
|
||||
let line = line + 1
|
||||
let linestr = getline(line)
|
||||
let m = matchlist(getline(line), '^\()\|\(\s\+\)\(\S*\s*\)"\(.\+\)"\)')
|
||||
if empty(m)
|
||||
if siteprefix == "" && a:enabled
|
||||
" must be in the first group
|
||||
break
|
||||
endif
|
||||
" record this position, but keep looking
|
||||
if firstblank < 0
|
||||
let firstblank = line
|
||||
endif
|
||||
continue
|
||||
endif
|
||||
if m[1] == ')'
|
||||
" if there's no match, add it to the first group
|
||||
if appendline < 0 && firstblank >= 0
|
||||
let appendline = firstblank
|
||||
endif
|
||||
break
|
||||
endif
|
||||
let lastprefix = matchstr(m[4], "^[^/]*/")
|
||||
if a:localname != '' && m[3] != ''
|
||||
let qlocalpath = printf('%-' . (len(m[3])-1) . 's %s', a:localname, qpath)
|
||||
endif
|
||||
let appendstr = m[2] . qlocalpath
|
||||
let indentstr = 0
|
||||
if m[4] == path
|
||||
let appendline = -1
|
||||
let deleteline = line
|
||||
break
|
||||
elseif m[4] < path
|
||||
" don't set candidate position if we have a site prefix,
|
||||
" we've passed a blank line, and this doesn't share the same
|
||||
" site prefix.
|
||||
if siteprefix == "" || firstblank < 0 || match(m[4], "^" . siteprefix) >= 0
|
||||
let appendline = line
|
||||
endif
|
||||
elseif siteprefix != "" && match(m[4], "^" . siteprefix) >= 0
|
||||
" first entry of site group
|
||||
let appendline = line - 1
|
||||
break
|
||||
endif
|
||||
endwhile
|
||||
break
|
||||
|
||||
elseif linestr =~# '^import '
|
||||
if appendline == packageline
|
||||
let appendstr = 'import ' . qlocalpath
|
||||
let appendline = line - 1
|
||||
endif
|
||||
let m = matchlist(linestr, '^import\(\s\+\)\(\S*\s*\)"\(.\+\)"')
|
||||
if !empty(m)
|
||||
if m[3] == path
|
||||
let appendline = -1
|
||||
let deleteline = line
|
||||
break
|
||||
endif
|
||||
if m[3] < path
|
||||
let appendline = line
|
||||
endif
|
||||
if a:localname != '' && m[2] != ''
|
||||
let qlocalpath = printf("%s %" . len(m[2])-1 . "s", a:localname, qpath)
|
||||
endif
|
||||
let appendstr = 'import' . m[1] . qlocalpath
|
||||
endif
|
||||
|
||||
elseif linestr =~# '^\(var\|const\|type\|func\)\>'
|
||||
break
|
||||
|
||||
endif
|
||||
let line = line + 1
|
||||
endwhile
|
||||
|
||||
" Append or remove the package import, as requested.
|
||||
if a:enabled
|
||||
if deleteline != -1
|
||||
call s:Error(qpath . ' already being imported')
|
||||
elseif appendline == -1
|
||||
call s:Error('No package line found')
|
||||
else
|
||||
if appendline == packageline
|
||||
call append(appendline + 0, '')
|
||||
call append(appendline + 1, 'import (')
|
||||
call append(appendline + 2, ')')
|
||||
let appendline += 2
|
||||
let linesdelta += 3
|
||||
let appendstr = qlocalpath
|
||||
let indentstr = 1
|
||||
endif
|
||||
call append(appendline, appendstr)
|
||||
execute appendline + 1
|
||||
if indentstr
|
||||
execute 'normal >>'
|
||||
endif
|
||||
let linesdelta += 1
|
||||
endif
|
||||
else
|
||||
if deleteline == -1
|
||||
call s:Error(qpath . ' not being imported')
|
||||
else
|
||||
execute deleteline . 'd'
|
||||
let linesdelta -= 1
|
||||
|
||||
if getline(deleteline-1) =~# '^import\s\+(' && getline(deleteline) =~# '^)'
|
||||
" Delete empty import block
|
||||
let deleteline -= 1
|
||||
execute deleteline . "d"
|
||||
execute deleteline . "d"
|
||||
let linesdelta -= 2
|
||||
endif
|
||||
|
||||
if getline(deleteline) == '' && getline(deleteline - 1) == ''
|
||||
" Delete spacing for removed line too.
|
||||
execute deleteline . "d"
|
||||
let linesdelta -= 1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
" Adjust view for any changes.
|
||||
let view.lnum += linesdelta
|
||||
let view.topline += linesdelta
|
||||
if view.topline < 0
|
||||
let view.topline = 0
|
||||
endif
|
||||
|
||||
" Put buffer back where it was.
|
||||
call winrestview(view)
|
||||
|
||||
endfunction
|
||||
|
||||
function! s:Error(s)
|
||||
echohl Error | echo a:s | echohl None
|
||||
endfunction
|
||||
|
||||
let b:did_ftplugin_go_import = 1
|
||||
|
||||
" vim:ts=4:sw=4:et
|
|
@ -0,0 +1,78 @@
|
|||
#!/bin/bash -e
|
||||
#
|
||||
# Copyright 2012 The Go Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style
|
||||
# license that can be found in the LICENSE file.
|
||||
#
|
||||
# Tests for import.vim.
|
||||
|
||||
cd $(dirname $0)
|
||||
|
||||
cat > base.go <<EOF
|
||||
package test
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"net"
|
||||
|
||||
"mycorp/foo"
|
||||
)
|
||||
EOF
|
||||
|
||||
fail=0
|
||||
|
||||
# usage: test_one command pattern
|
||||
# Pattern is a PCRE expression that will match across lines.
|
||||
test_one() {
|
||||
echo 2>&1 -n "$1: "
|
||||
vim -e -s -u /dev/null -U /dev/null --noplugin -c "source import.vim" \
|
||||
-c "$1" -c 'wq! test.go' base.go
|
||||
# ensure blank lines are treated correctly
|
||||
if ! gofmt test.go | cmp test.go -; then
|
||||
echo 2>&1 "gofmt conflict"
|
||||
gofmt test.go | diff -u test.go - | sed "s/^/ /" 2>&1
|
||||
fail=1
|
||||
return
|
||||
fi
|
||||
if ! [[ $(cat test.go) =~ $2 ]]; then
|
||||
echo 2>&1 "$2 did not match"
|
||||
cat test.go | sed "s/^/ /" 2>&1
|
||||
fail=1
|
||||
return
|
||||
fi
|
||||
echo 2>&1 "ok"
|
||||
}
|
||||
|
||||
# Tests for Import
|
||||
|
||||
test_one "Import baz" '"baz".*"bytes"'
|
||||
test_one "Import io/ioutil" '"io".*"io/ioutil".*"net"'
|
||||
test_one "Import myc" '"io".*"myc".*"net"' # prefix of a site prefix
|
||||
test_one "Import nat" '"io".*"nat".*"net"'
|
||||
test_one "Import net/http" '"net".*"net/http".*"mycorp/foo"'
|
||||
test_one "Import zoo" '"net".*"zoo".*"mycorp/foo"'
|
||||
test_one "Import mycorp/bar" '"net".*"mycorp/bar".*"mycorp/foo"'
|
||||
test_one "Import mycorp/goo" '"net".*"mycorp/foo".*"mycorp/goo"'
|
||||
|
||||
# Tests for Drop
|
||||
|
||||
cat > base.go <<EOF
|
||||
package test
|
||||
|
||||
import (
|
||||
"foo"
|
||||
|
||||
"something"
|
||||
"zoo"
|
||||
)
|
||||
EOF
|
||||
|
||||
test_one "Drop something" '\([^"]*"foo"[^"]*"zoo"[^"]*\)'
|
||||
|
||||
rm -f base.go test.go
|
||||
if [ $fail -gt 0 ]; then
|
||||
echo 2>&1 "FAIL"
|
||||
exit 1
|
||||
fi
|
||||
echo 2>&1 "PASS"
|
|
@ -0,0 +1,133 @@
|
|||
" General options
|
||||
set backspace=indent,eol,start
|
||||
set cindent autoindent
|
||||
set confirm
|
||||
set encoding=utf-8
|
||||
set incsearch
|
||||
set hidden
|
||||
set mouse=a
|
||||
set nocompatible
|
||||
set noexpandtab
|
||||
set nohlsearch
|
||||
set number
|
||||
set ruler
|
||||
set showcmd
|
||||
set showmatch
|
||||
set showmode
|
||||
set tags=./tags,tags,/usr/src/sys/arch/amd64/tags,/var/db/libc.tags
|
||||
set t_Co=256
|
||||
set ttyfast
|
||||
source /usr/share/vim/vim82/ftplugin/man.vim
|
||||
|
||||
filetype plugin on
|
||||
|
||||
nnoremap <C-N> :tag<CR>
|
||||
nnoremap <C-P> :pop<CR>
|
||||
|
||||
nnoremap <C-P> :bprev<CR>
|
||||
|
||||
" fix glitches in certain terminals
|
||||
" backspace
|
||||
imap ^? ^H
|
||||
|
||||
" f7 toggles spelling on/off
|
||||
nn <F7> :setlocal spell! spell?<CR>
|
||||
|
||||
" view binary files as hex
|
||||
" Convert to hex and back; does not save changes
|
||||
nn <F5> :%!xxd -g 1<CR>
|
||||
nn <F6> :%!xxd -g 1 -r<CR>
|
||||
|
||||
" makefile magic
|
||||
" compiler stuff
|
||||
let g:compiler_gcc_ignore_unmatched_lines=1
|
||||
let mapleader=','
|
||||
" quickfix :make
|
||||
nmap <silent> <Leader>m :wa<CR>:silent! make \| redraw! \| cw<CR><CR>
|
||||
vmap <silent> <Leader>m :wa<CR>:silent! make \| redraw! \| cw<CR><CR>
|
||||
nn ,c :silent! make clean \| redraw! \| cw<CR><CR>
|
||||
" handy shortcuts
|
||||
map <Leader>h :ccl<CR>
|
||||
map <Leader>s :cw<CR>
|
||||
map <Leader>l :cl<CR>
|
||||
" jump between messages
|
||||
map <Leader>n :cn<CR>
|
||||
map <Leader>p :cp<CR>
|
||||
|
||||
" format selection
|
||||
map <Leader>f :!fmt<CR>
|
||||
|
||||
|
||||
" @c comment, @u uncomment, @p print function name
|
||||
let @u='0xx$xx^['
|
||||
let @c='I/*^[A*/^['
|
||||
let @p='ofprintf(stderr, "%s\n", __func__);^['
|
||||
|
||||
:ab #d #define
|
||||
:ab #i #include
|
||||
|
||||
autocmd FileType make setlocal noexpandtab
|
||||
autocmd FileType c setlocal noexpandtab
|
||||
autocmd FileType cc setlocal noexpandtab
|
||||
autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4
|
||||
autocmd FileType ada setlocal expandtab shiftwidth=3 softtabstop=3 tabstop=3
|
||||
|
||||
" Plugins
|
||||
|
||||
" Initialization
|
||||
call plug#begin('~/.vim/bundle')
|
||||
|
||||
Plug 'scrooloose/nerdtree'
|
||||
Plug 'junegunn/fzf'
|
||||
Plug 'fatih/vim-go', { 'for': 'go' }
|
||||
Plug 'ambv/black', { 'for': 'python' }
|
||||
Plug 'mileszs/ack.vim'
|
||||
Plug 'racer-rust/vim-racer', { 'for': 'rust' }
|
||||
|
||||
" Themes
|
||||
Plug 'KKPMW/oldbook-vim'
|
||||
Plug 'agreco/vim-citylights'
|
||||
Plug 'xdefrag/vim-beelzebub'
|
||||
Plug 'logico-dev/typewriter'
|
||||
Plug 'vim-scripts/wombat256.vim'
|
||||
|
||||
call plug#end()
|
||||
|
||||
" NERDTree
|
||||
map <Leader>o :NERDTree<CR>
|
||||
|
||||
" FZF
|
||||
nmap <leader><tab> <plug>(fzf-maps-n)
|
||||
xmap <leader><tab> <plug>(fzf-maps-x)
|
||||
omap <leader><tab> <plug>(fzf-maps-o)
|
||||
imap <c-x><c-k> <plug>(fzf-complete-word)
|
||||
imap <c-x><c-f> <plug>(fzf-complete-path)
|
||||
imap <c-x><c-j> <plug>(fzf-complete-file-ag)
|
||||
imap <c-x><c-l> <plug>(fzf-complete-line)
|
||||
|
||||
command! FZFBuffers call fzf#run({'source': map(range(1, bufnr('$')), 'bufname(v:val)'), 'sink': 'e', 'down': '30%'})
|
||||
map <Leader>b :FZFBuffers<CR>
|
||||
|
||||
" Ack
|
||||
if executable('ag')
|
||||
let g:ackprg = 'ag --vimgrep'
|
||||
endif
|
||||
|
||||
" The space is signficant.
|
||||
map <Leader>/ :Ack
|
||||
|
||||
" Go stuff
|
||||
map <Leader>i :GoImports<CR>
|
||||
map <Leader>i :GoImports<CR>
|
||||
|
||||
let g:go_fmt_autosave = 1
|
||||
let g:go_fmt_command = "goimports"
|
||||
|
||||
au FileType rust nmap gd <Plug>(rust-def)
|
||||
autocmd Filetype c,cpp inoremap <buffer> <Leader>t :wa<CR>:silent! make test \| redraw! \| cw<CR><CR>
|
||||
autocmd Filetype go map <buffer> <Leader>t :wa<CR>:GoTest<CR>
|
||||
autocmd Filetype go map <buffer> C-] :w<CR>:GoDef<CR>
|
||||
autocmd Filetype go map <buffer> C-\ :w<CR>:GoDefPop<CR>
|
||||
|
||||
|
||||
colorscheme oldbook
|
|
@ -0,0 +1,15 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
if [ -z "$DISPLAY" ]
|
||||
then
|
||||
NW=""
|
||||
else
|
||||
NW="-n"
|
||||
fi
|
||||
|
||||
if [ -z "$@" ]
|
||||
then
|
||||
cd $HOME
|
||||
fi
|
||||
|
||||
emacsclient $NW -c -a '' "$@"
|
Loading…
Reference in New Issue